573188bdc4
Currently FirThisReceiverExpression of instance methods are translated to references of the class' thisReceiver, not the method's dispatch receiver, which causes problems with IrFrameMap::typeOf, as the class' thisReceiver is not in the typeMap. This commit translates non-qualified "this" references of instance methods to references of the methods' dispatch receiver.
42 lines
964 B
Kotlin
Vendored
42 lines
964 B
Kotlin
Vendored
// TARGET_BACKEND: JVM
|
|
// FILE: WithoutPrimary.java
|
|
|
|
class WithoutPrimary {
|
|
public static A test1() {
|
|
return new A("123", "abc");
|
|
}
|
|
public static A test3() {
|
|
return new A("123", 456);
|
|
}
|
|
public static A test4() {
|
|
return new A(1.0);
|
|
}
|
|
}
|
|
|
|
// FILE: WithoutPrimary.kt
|
|
|
|
class A {
|
|
val x: String
|
|
val y: String
|
|
constructor(x: String, y: String) {
|
|
this.x = x
|
|
this.y = y
|
|
}
|
|
constructor(x: String = "def_x", y: Int = 1): this(x, y.toString()) {}
|
|
constructor(x: Double): this(x.toString(), "def_y") {}
|
|
override fun toString() = "$x#$y"
|
|
}
|
|
|
|
fun box(): String {
|
|
val test1 = WithoutPrimary.test1().toString()
|
|
if (test1 != "123#abc") return "fail1: $test1"
|
|
|
|
val test3 = WithoutPrimary.test3().toString()
|
|
if (test3 != "123#456") return "fail3: $test3"
|
|
|
|
val test4 = WithoutPrimary.test4().toString()
|
|
if (test4 != "1.0#def_y") return "fail4: $test4"
|
|
|
|
return "OK"
|
|
}
|