Add a couple more tests for array constructors and references
This commit is contained in:
+6
@@ -2410,6 +2410,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("arrayConstructorArgument.kt")
|
||||
public void testArrayConstructorArgument() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/arrayConstructorArgument.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("builtinFunctionReferenceOwner.kt")
|
||||
public void testBuiltinFunctionReferenceOwner() throws Exception {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: PROPERTY_REFERENCES
|
||||
fun foo(it: Int) = "O"[it]
|
||||
|
||||
val Int.foo: Char
|
||||
get() = "K"[this]
|
||||
|
||||
fun box(): String =
|
||||
CharArray(1, ::foo)[0].toString() + CharArray(1, Int::foo)[0].toString()
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: BINDING_RECEIVERS
|
||||
class C(val x: String) {
|
||||
fun foo(i: Int): Char = x[i]
|
||||
}
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo1(x: Int) = x
|
||||
fun foo2(vararg x: Int) = x[0]
|
||||
fun Int.foo3() = this
|
||||
fun IntArray.foo4(x: Int) = this[x]
|
||||
val Int.foo5 get() = this
|
||||
|
||||
fun test() {
|
||||
// None of this should create any Function1 implementations because IntArray is inline.
|
||||
IntArray(1, ::foo1)
|
||||
IntArray(1, ::foo2)
|
||||
IntArray(1, Int::foo3)
|
||||
IntArray(1, intArrayOf(0)::foo4)
|
||||
IntArray(1, Int::foo5)
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
@kotlin.Metadata
|
||||
public final class CallableReferenceArrayConstructorArgumentsKt {
|
||||
// source: 'callableReferenceArrayConstructorArguments.kt'
|
||||
public final static method foo1(p0: int): int
|
||||
public varargs final static method foo2(@org.jetbrains.annotations.NotNull p0: int[]): int
|
||||
public final static method foo3(p0: int): int
|
||||
public final static method foo4(@org.jetbrains.annotations.NotNull p0: int[], p1: int): int
|
||||
public final static method getFoo5(p0: int): int
|
||||
public final static method test(): void
|
||||
}
|
||||
+6
@@ -2410,6 +2410,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("arrayConstructorArgument.kt")
|
||||
public void testArrayConstructorArgument() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/arrayConstructorArgument.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("builtinFunctionReferenceOwner.kt")
|
||||
public void testBuiltinFunctionReferenceOwner() throws Exception {
|
||||
|
||||
+6
@@ -61,6 +61,12 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/callableNameIntrinsic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceArrayConstructorArguments.kt")
|
||||
public void testCallableReferenceArrayConstructorArguments() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/callableReferenceArrayConstructorArguments.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("cloneable.kt")
|
||||
public void testCloneable() throws Exception {
|
||||
|
||||
+6
@@ -2410,6 +2410,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("arrayConstructorArgument.kt")
|
||||
public void testArrayConstructorArgument() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/arrayConstructorArgument.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("builtinFunctionReferenceOwner.kt")
|
||||
public void testBuiltinFunctionReferenceOwner() throws Exception {
|
||||
|
||||
+6
@@ -61,6 +61,12 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes
|
||||
runTest("compiler/testData/codegen/bytecodeListing/callableNameIntrinsic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceArrayConstructorArguments.kt")
|
||||
public void testCallableReferenceArrayConstructorArguments() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/callableReferenceArrayConstructorArguments.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("cloneable.kt")
|
||||
public void testCloneable() throws Exception {
|
||||
|
||||
+5
@@ -2140,6 +2140,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("arrayConstructorArgument.kt")
|
||||
public void testArrayConstructorArgument() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/arrayConstructorArgument.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("builtinFunctionReferenceOwner.kt")
|
||||
public void testBuiltinFunctionReferenceOwner() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/builtinFunctionReferenceOwner.kt");
|
||||
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -1455,6 +1455,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
|
||||
}
|
||||
|
||||
@TestMetadata("arrayConstructorArgument.kt")
|
||||
public void testArrayConstructorArgument() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/arrayConstructorArgument.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("genericConstructorReference.kt")
|
||||
public void testGenericConstructorReference() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/genericConstructorReference.kt");
|
||||
|
||||
Generated
+5
@@ -1455,6 +1455,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("arrayConstructorArgument.kt")
|
||||
public void testArrayConstructorArgument() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/arrayConstructorArgument.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("genericConstructorReference.kt")
|
||||
public void testGenericConstructorReference() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/genericConstructorReference.kt");
|
||||
|
||||
Generated
+5
@@ -1455,6 +1455,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@TestMetadata("arrayConstructorArgument.kt")
|
||||
public void testArrayConstructorArgument() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/arrayConstructorArgument.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("genericConstructorReference.kt")
|
||||
public void testGenericConstructorReference() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/genericConstructorReference.kt");
|
||||
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java
Generated
-5
@@ -1363,11 +1363,6 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/callableReference/bound"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("arrayConstructorArgument.kt")
|
||||
public void testArrayConstructorArgument() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/bound/arrayConstructorArgument.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("captureVarInInitBlock.kt")
|
||||
public void testCaptureVarInInitBlock() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/bound/captureVarInInitBlock.kt");
|
||||
|
||||
Reference in New Issue
Block a user