File tree 5 files changed +88
-0
lines changed
kotlin-native/backend.native/tests
5 files changed +88
-0
lines changed Original file line number Diff line number Diff line change @@ -2814,6 +2814,20 @@ standaloneTest("devirtualization_anonymousObject") {
2814
2814
source = " codegen/devirtualization/anonymousObject.kt"
2815
2815
}
2816
2816
2817
+ standaloneTest(" devirtualization_kt67281c" ) {
2818
+ disabled = (cacheTesting != null ) // Cache is not compatible with -opt.
2819
+ useGoldenData = true
2820
+ flags = [" -opt" ]
2821
+ source = " codegen/devirtualization/kt67218c.kt"
2822
+ }
2823
+
2824
+ standaloneTest(" devirtualization_kt67281i" ) {
2825
+ disabled = (cacheTesting != null ) // Cache is not compatible with -opt.
2826
+ useGoldenData = true
2827
+ flags = [" -opt" ]
2828
+ source = " codegen/devirtualization/kt67218i.kt"
2829
+ }
2830
+
2817
2831
tasks. register(" interfaceCallsNCasts_conservativeItable" , KonanLocalTest ) {
2818
2832
useGoldenData = true
2819
2833
source = " codegen/interfaceCallsNCasts/conservativeItable.kt"
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
3
+ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
4
+ */
5
+
6
+ open class A {
7
+ open fun foo () = 42
8
+ }
9
+
10
+ open class B : A () {
11
+ override fun foo () = 117
12
+ }
13
+
14
+ class C : A ()
15
+
16
+ class D : A ()
17
+
18
+ class E : B ()
19
+
20
+ class F : B ()
21
+
22
+ class G : B ()
23
+
24
+ fun foo (a : A ) = a.foo()
25
+
26
+ fun box (): String {
27
+ if (foo(E ()) != 117 ) return " fail 1"
28
+ if (foo(F ()) != 117 ) return " fail 2"
29
+ if (foo(G ()) != 117 ) return " fail 3"
30
+ if (foo(C ()) != 42 ) return " fail 4"
31
+ if (foo(D ()) != 42 ) return " fail 5"
32
+
33
+ return " OK"
34
+ }
35
+
36
+ fun main () = println (box())
Original file line number Diff line number Diff line change
1
+ OK
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
3
+ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
4
+ */
5
+
6
+ interface I {
7
+ fun foo () = 42
8
+ }
9
+
10
+ open class B : I {
11
+ override fun foo () = 117
12
+ }
13
+
14
+ class C : I
15
+
16
+ class D : I
17
+
18
+ class E : B ()
19
+
20
+ class F : B ()
21
+
22
+ class G : B ()
23
+
24
+ fun foo (i : I ) = i.foo()
25
+
26
+ fun box (): String {
27
+ if (foo(E ()) != 117 ) return " fail 1"
28
+ if (foo(F ()) != 117 ) return " fail 2"
29
+ if (foo(G ()) != 117 ) return " fail 3"
30
+ if (foo(C ()) != 42 ) return " fail 4"
31
+ if (foo(D ()) != 42 ) return " fail 5"
32
+
33
+ return " OK"
34
+ }
35
+
36
+ fun main () = println (box())
Original file line number Diff line number Diff line change
1
+ OK
You can’t perform that action at this time.
0 commit comments