diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index c7afcbf613c..fe9190f4f7e 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -651,6 +651,36 @@ task delegatedProperty_map(type: RunKonanTest) { source = "codegen/delegatedProperty/map.kt" } +task propertyCallableReference_valClass(type: RunKonanTest) { + goldValue = "42\n117\n" + source = "codegen/propertyCallableReference/valClass.kt" +} + +task propertyCallableReference_valModule(type: RunKonanTest) { + goldValue = "42\n" + source = "codegen/propertyCallableReference/valModule.kt" +} + +task propertyCallableReference_varClass(type: RunKonanTest) { + goldValue = "117\n117\n42\n42\n" + source = "codegen/propertyCallableReference/varClass.kt" +} + +task propertyCallableReference_varModule(type: RunKonanTest) { + goldValue = "117\n117\n" + source = "codegen/propertyCallableReference/varModule.kt" +} + +task propertyCallableReference_valExtension(type: RunKonanTest) { + goldValue = "42\n117\n" + source = "codegen/propertyCallableReference/valExtension.kt" +} + +task propertyCallableReference_varExtension(type: RunKonanTest) { + goldValue = "117\n117\n42\n42\n" + source = "codegen/propertyCallableReference/varExtension.kt" +} + task array0(type: RunKonanTest) { goldValue = "5\n6\n7\n8\n9\n10\n11\n12\n13\n" source = "runtime/collections/array0.kt" diff --git a/backend.native/tests/codegen/propertyCallableReference/valClass.kt b/backend.native/tests/codegen/propertyCallableReference/valClass.kt new file mode 100644 index 00000000000..9e3f29f56f5 --- /dev/null +++ b/backend.native/tests/codegen/propertyCallableReference/valClass.kt @@ -0,0 +1,9 @@ +class A(val x: Int) + +fun main(args: Array) { + val p1 = A::x + println(p1.get(A(42))) + val a = A(117) + val p2 = a::x + println(p2.get()) +} \ No newline at end of file diff --git a/backend.native/tests/codegen/propertyCallableReference/valExtension.kt b/backend.native/tests/codegen/propertyCallableReference/valExtension.kt new file mode 100644 index 00000000000..ef7a7dcc4ee --- /dev/null +++ b/backend.native/tests/codegen/propertyCallableReference/valExtension.kt @@ -0,0 +1,13 @@ +class A(y: Int) { + var x = y +} + +val A.z get() = this.x + +fun main(args: Array) { + val p1 = A::z + println(p1.get(A(42))) + val a = A(117) + val p2 = a::z + println(p2.get()) +} \ No newline at end of file diff --git a/backend.native/tests/codegen/propertyCallableReference/valModule.kt b/backend.native/tests/codegen/propertyCallableReference/valModule.kt new file mode 100644 index 00000000000..800051cebfa --- /dev/null +++ b/backend.native/tests/codegen/propertyCallableReference/valModule.kt @@ -0,0 +1,6 @@ +val x = 42 + +fun main(args: Array) { + val p = ::x + println(p.get()) +} \ No newline at end of file diff --git a/backend.native/tests/codegen/propertyCallableReference/varClass.kt b/backend.native/tests/codegen/propertyCallableReference/varClass.kt new file mode 100644 index 00000000000..a0b4e060a4e --- /dev/null +++ b/backend.native/tests/codegen/propertyCallableReference/varClass.kt @@ -0,0 +1,13 @@ +class A(var x: Int) + +fun main(args: Array) { + val p1 = A::x + val a = A(42) + p1.set(a, 117) + println(a.x) + println(p1.get(a)) + val p2 = a::x + p2.set(42) + println(a.x) + println(p2.get()) +} \ No newline at end of file diff --git a/backend.native/tests/codegen/propertyCallableReference/varExtension.kt b/backend.native/tests/codegen/propertyCallableReference/varExtension.kt new file mode 100644 index 00000000000..9f304fddd50 --- /dev/null +++ b/backend.native/tests/codegen/propertyCallableReference/varExtension.kt @@ -0,0 +1,21 @@ +class A(y: Int) { + var x = y +} + +var A.z: Int + get() = this.x + set(value: Int) { + this.x = value + } + +fun main(args: Array) { + val p1 = A::z + val a = A(42) + p1.set(a, 117) + println(a.x) + println(p1.get(a)) + val p2 = a::z + p2.set(42) + println(a.x) + println(p2.get()) +} \ No newline at end of file diff --git a/backend.native/tests/codegen/propertyCallableReference/varModule.kt b/backend.native/tests/codegen/propertyCallableReference/varModule.kt new file mode 100644 index 00000000000..627076ca8f7 --- /dev/null +++ b/backend.native/tests/codegen/propertyCallableReference/varModule.kt @@ -0,0 +1,8 @@ +var x = 42 + +fun main(args: Array) { + val p = ::x + p.set(117) + println(x) + println(p.get()) +} \ No newline at end of file