-
-
Notifications
You must be signed in to change notification settings - Fork 662
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[java] don't check native signatures on extern functions
closes #11131
- Loading branch information
Showing
7 changed files
with
83 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
@:native("test.MathOperation") | ||
extern class MathOperation { | ||
public static inline overload function perform(op:Int->Int, value:Int) { | ||
return op(value); | ||
} | ||
|
||
public static inline overload function perform(op:Int->Int->Int, value:Int) { | ||
return op(value, value); | ||
} | ||
} | ||
|
||
@:native("test.MathOperation") | ||
class MathOperationNotExtern { | ||
public static extern inline overload function perform(op:Int->Int, value:Int) { | ||
return op(value); | ||
} | ||
|
||
public static extern inline overload function perform(op:Int->Int->Int, value:Int) { | ||
return op(value, value); | ||
} | ||
} | ||
|
||
class Main { | ||
static function main() { | ||
Sys.println(MathOperation.perform(double, 3)); | ||
Sys.println(MathOperation.perform(multiply, 3)); | ||
Sys.println(MathOperationNotExtern.perform(double, 3)); | ||
Sys.println(MathOperationNotExtern.perform(multiply, 3)); | ||
} | ||
|
||
static function double(a):Int { | ||
return a * 2; | ||
} | ||
|
||
static function multiply(a, b):Int { | ||
return a * b; | ||
} | ||
} |
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,25 @@ | ||
@:native("test.MathOperation") | ||
class MathOperation { | ||
public static inline overload function perform(op:Int->Int, value:Int) { | ||
return op(value); | ||
} | ||
|
||
public static inline overload function perform(op:Int->Int->Int, value:Int) { | ||
return op(value, value); | ||
} | ||
} | ||
|
||
class MainFail { | ||
static function main() { | ||
Sys.println(MathOperation.perform(double, 3)); | ||
Sys.println(MathOperation.perform(multiply, 3)); | ||
} | ||
|
||
static function double(a):Int { | ||
return a * 2; | ||
} | ||
|
||
static function multiply(a, b):Int { | ||
return a * b; | ||
} | ||
} |
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,3 @@ | ||
-cp src | ||
-main MainFail | ||
--jvm run.jar |
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,3 @@ | ||
MainFail.hx:3: lines 3-5 : Another overloaded field of similar signature was already declared : perform | ||
MainFail.hx:3: lines 3-5 : ... The signatures are different in Haxe, but not in the target language | ||
MainFail.hx:7: lines 7-9 : ... The second field is declared here |
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,4 @@ | ||
-cp src | ||
-main Main | ||
--jvm run.jar | ||
--cmd java -jar run.jar |
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,4 @@ | ||
6 | ||
9 | ||
6 | ||
9 |