Add forgotten test files

This commit is contained in:
Georgy Bronnikov
2020-06-18 12:22:41 +03:00
parent cf6eb138ce
commit ee6d432ced
5 changed files with 413 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
// FILE: Java1.java
public class Java1 {
public int f;
}
// FILE: Java2.java
public class Java2 extends Kotlin1 {
}
// FILE: test.kt
open class Kotlin1 : Java1()
open class Kotlin2 : Java2() {
fun getF() = super.f
}
fun test1(j: Kotlin2) = j.f
// @Kotlin2.class:
// 1 GETFIELD Java2.f : I
// @TestKt.class:
// 1 GETFIELD Kotlin2.f : I
@@ -0,0 +1,39 @@
// !LANGUAGE: +NewInference
// (old inference fails in the frontend)
// FILE: JFieldOwner.java
public class JFieldOwner {
public int f;
}
// FILE: test.kt
interface IFoo
class Derived1 : JFieldOwner(), IFoo
class Derived2 : JFieldOwner(), IFoo
open class Mid : JFieldOwner()
class DerivedThroughMid1 : Mid(), IFoo
class DerivedThroughMid2 : Mid(), IFoo
fun test(b : Boolean) {
val d1 = Derived1()
val d2 = Derived2()
val k = if (b) d1 else d2
k.f = 42
k.f
val md1 = DerivedThroughMid1()
val md2 = DerivedThroughMid2()
val mk = if (b) md1 else md2
mk.f = 44
mk.f
}
// @TestKt.class:
// 1 GETFIELD JFieldOwner.f : I
// 1 PUTFIELD JFieldOwner.f : I
// 1 GETFIELD Mid.f : I
// 1 PUTFIELD Mid.f : I