-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
186c2af
commit 8f8ab04
Showing
5 changed files
with
42 additions
and
18 deletions.
There are no files selected for viewing
14 changes: 0 additions & 14 deletions
14
tern-compile/src/test/java/org/ternlang/compile/staticanalysis/InvalidGenericCountTest.java
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
tern-compile/src/test/java/org/ternlang/compile/staticanalysis/InvalidGenericsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.ternlang.compile.staticanalysis; | ||
|
||
public class InvalidGenericsTest extends CompileTestCase { | ||
|
||
private static final String FAILURE_1 = | ||
"class Foo<T>{\n"+ | ||
" dump(a): T {}\n"+ | ||
"}\n"+ | ||
"new Foo<Double>().dump(11).size();\n"; | ||
|
||
private static final String FAILURE_2 = | ||
"class Foo<T>{\n"+ | ||
" dump(a): T {}\n"+ | ||
"}\n"+ | ||
"Foo<Double>().dump(11).size();\n"; | ||
|
||
private static final String FAILURE_3 = | ||
"func fun<A, B>(a: A): List<B> {\n"+ | ||
" return null;\n"+ | ||
"}\n"+ | ||
"fun<Double, Double, Double>(1.0).intValue();\n"; | ||
|
||
public void testGenericFunction() throws Exception { | ||
assertCompileError(FAILURE_1, "Function 'size()' not found for 'lang.Double' in /default.tern at line 4"); | ||
assertCompileError(FAILURE_2, "Function 'size()' not found for 'lang.Double' in /default.tern at line 4"); | ||
assertCompileError(FAILURE_3, "Generic parameter count for 'default.fun(a: Object)' is invalid in /default.tern at line 4"); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters