FIR: fork flow on function entry, restore receivers on exit

^KT-52680 Fixed
This commit is contained in:
pyos
2022-06-09 11:34:59 +02:00
committed by Dmitriy Novozhilov
parent 3ba11711d2
commit 9968fa252a
11 changed files with 116 additions and 23 deletions
@@ -0,0 +1,24 @@
interface I {
val prop: Int
}
open class A {
fun f1() {
this as I
prop
}
fun f2() {
<!UNRESOLVED_REFERENCE!>prop<!>
}
}
open class B {
fun f() {
{
this as I
prop
}
<!UNRESOLVED_REFERENCE!>prop<!>
}
}
@@ -0,0 +1,24 @@
interface I {
val prop: Int
}
open class A {
fun f1() {
this as I
<!DEBUG_INFO_IMPLICIT_RECEIVER_SMARTCAST!>prop<!>
}
fun f2() {
<!UNRESOLVED_REFERENCE!>prop<!>
}
}
open class B {
fun f() {
{
this as I
<!DEBUG_INFO_IMPLICIT_RECEIVER_SMARTCAST!>prop<!>
}
<!UNRESOLVED_REFERENCE!>prop<!>
}
}
@@ -0,0 +1,25 @@
package
public open class A {
public constructor A()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final fun f1(): kotlin.Unit
public final fun f2(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public open class B {
public constructor B()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final fun f(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface I {
public abstract val prop: kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -1,10 +0,0 @@
fun x(): Boolean { return true }
public fun foo(p: String?): Int {
// Exotic variant with unused literal
do { ->
p!!.length
} while (!x())
// Literal is not called so p.length is unsafe
return p.length
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
fun x(): Boolean { return true }
public fun foo(p: String?): Int {