Test for function with default parameters marked native
This commit is contained in:
@@ -0,0 +1,31 @@
|
|||||||
|
package foo
|
||||||
|
|
||||||
|
import kotlin.jvm.*
|
||||||
|
import kotlin.platform.*
|
||||||
|
|
||||||
|
object ObjWithNative {
|
||||||
|
native fun foo(x: Int = 1): Double
|
||||||
|
|
||||||
|
platformStatic native fun bar(l: Long, s: String = ""): Double
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
var d = 0.0
|
||||||
|
|
||||||
|
try {
|
||||||
|
d = ObjWithNative.bar(1)
|
||||||
|
return "Link error expected on object"
|
||||||
|
}
|
||||||
|
catch (e: java.lang.UnsatisfiedLinkError) {
|
||||||
|
if (e.getMessage() != "foo.ObjWithNative.bar(JLjava/lang/String;)D") return "Fail 1: " + e.getMessage()
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
d = ObjWithNative.foo()
|
||||||
|
return "Link error expected on object"
|
||||||
|
}
|
||||||
|
catch (e: java.lang.UnsatisfiedLinkError) {
|
||||||
|
if (e.getMessage() != "foo.ObjWithNative.foo(I)D") return "Fail 2: " + e.getMessage()
|
||||||
|
}
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+6
@@ -1819,6 +1819,12 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
|
|||||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithStdlib/native"), Pattern.compile("^(.+)\\.kt$"), true);
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithStdlib/native"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("default.kt")
|
||||||
|
public void testDefault() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/native/default.kt");
|
||||||
|
doTestWithStdlib(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("simpleNative.kt")
|
@TestMetadata("simpleNative.kt")
|
||||||
public void testSimpleNative() throws Exception {
|
public void testSimpleNative() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/native/simpleNative.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/native/simpleNative.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user