[FIR2IR] Fix labeled this references

This commit is contained in:
simon.ogorodnik
2020-04-27 23:00:47 +03:00
committed by Mikhail Glukhikh
parent 3d60fdfed1
commit a11866ab5a
17 changed files with 20 additions and 38 deletions
@@ -287,7 +287,6 @@ class Fir2IrVisitor(
override fun visitThisReceiverExpression(thisReceiverExpression: FirThisReceiverExpression, data: Any?): IrElement { override fun visitThisReceiverExpression(thisReceiverExpression: FirThisReceiverExpression, data: Any?): IrElement {
val calleeReference = thisReceiverExpression.calleeReference val calleeReference = thisReceiverExpression.calleeReference
val boundSymbol = calleeReference.boundSymbol val boundSymbol = calleeReference.boundSymbol
if (calleeReference.labelName == null) {
if (boundSymbol is FirClassSymbol) { if (boundSymbol is FirClassSymbol) {
// Object case // Object case
val firClass = boundSymbol.fir as FirClass val firClass = boundSymbol.fir as FirClass
@@ -315,7 +314,6 @@ class Fir2IrVisitor(
} }
} }
} }
}
// TODO handle qualified "this" in instance methods of non-inner classes (inner class cases are handled by InnerClassesLowering) // TODO handle qualified "this" in instance methods of non-inner classes (inner class cases are handled by InnerClassesLowering)
return visitQualifiedAccessExpression(thisReceiverExpression, data) return visitQualifiedAccessExpression(thisReceiverExpression, data)
} }
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: JS_IR
// TODO: muted automatically, investigate should it be ran for JS or not // TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE // IGNORE_BACKEND: JS, NATIVE
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class A { class A {
var value: String = "fail1" var value: String = "fail1"
private set private set
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun test1(str: String): String { fun test1(str: String): String {
data class A(val x: Int) { data class A(val x: Int) {
fun foo() = str fun foo() = str
@@ -1,5 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER // !DIAGNOSTICS: -UNUSED_PARAMETER
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: JS_IR
// TODO: muted automatically, investigate should it be ran for JS or not // TODO: muted automatically, investigate should it be ran for JS or not
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun Int.thisRef1() = fun () = this fun Int.thisRef1() = fun () = this
fun Int.thisRef2() = fun (): Int {return this} fun Int.thisRef2() = fun (): Int {return this}
@@ -1,5 +1,4 @@
// !LANGUAGE: +NewInference // !LANGUAGE: +NewInference
// IGNORE_BACKEND_FIR: JVM_IR
// NewInference needed because of KT-26531 // NewInference needed because of KT-26531
fun Int.thisRef1() = fun () = this fun Int.thisRef1() = fun () = this
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
val Int.getter: Int val Int.getter: Int
get() { get() {
return this@getter return this@getter
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
val Int.getter: Int val Int.getter: Int
get() { get() {
return { return {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
val Int.getter: Int val Int.getter: Int
get() { get() {
val extFun: Int.() -> Int = { val extFun: Int.() -> Int = {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
interface Base { interface Base {
fun foo(): Int fun foo(): Int
} }
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Test { class Test {
val Int.innerGetter: Int val Int.innerGetter: Int
get() { get() {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
package test package test
val A.a: String val A.a: String
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
package test package test
class C(val s : String) { class C(val s : String) {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
package test package test
class C(val s : String) { class C(val s : String) {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Outer { class Outer {
val foo = "Foo" val foo = "Foo"
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
open class A(open val v: String) { open class A(open val v: String) {
} }