Skip to content

Commit

Permalink
fix Issue#61
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingo60 committed Dec 22, 2013
1 parent 34ac1c4 commit e2fdeea
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 7 deletions.
14 changes: 7 additions & 7 deletions frege/compiler/tc/Methods.fr
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ derive Show NIKind
{--
determine kind of java expression to generate, based on the item information
-}
niKind "new" = NINew
niKind #^\W+$# = NIOp
niKind #^\w+$# = NIMethod
niKind #^\.\w+$# = NIMember
niKind #^\(.+\)$# = NICast
niKind #.+\[\]$# = NINewArray
niKind _ = NIStatic
niKind "new" = NINew
niKind ´^\W+$´ = NIOp
niKind ´^[\w\$]+$´ = NIMethod
niKind ´^\.[\w\$]+$´ = NIMember
niKind ´^\(.+\)$´ = NICast
niKind ´.+\[\]$´ = NINewArray
niKind _ = NIStatic

{--
Check the sanity of the type of a native method, whose symbol is passed.
Expand Down
12 changes: 12 additions & 0 deletions tests/comp/I61Java.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package tests.comp;

/**
* <p>Test calss to demonstrate that $ in method names and member names work.</p>
* @author ingo
*
*/
final public class I61Java {
final public int mem$1;
final public int $getMem1$() { return mem$1;}
public I61Java(int arg) { mem$1 = arg; }
}
21 changes: 21 additions & 0 deletions tests/comp/Issue61.fr
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--- 'https://github.com/Frege/frege/issues/61 Issue#61'
{--
Compiler does not recognize instance methods and members
that have a @$@ sign in their name.
-}
module tests.comp.Issue61 where


data Native = pure native tests.comp.I61Java where
pure native new :: Int -> Native
pure native member ".mem$1" :: Native -> Int
pure native method "$getMem1$" :: Native -> Int

main _ = do
let nat = Native.new 42
print "Member mem$1 is "
println nat.member
print "Method $getMem1$ returns "
println nat.method


0 comments on commit e2fdeea

Please sign in to comment.