FIR2IR: Fix complex cases of smart cast expressions used as dispatch receiver

It might be not only <ExpressionWithSmartCast>(a).foo(), but also
id(<ExpressionWithSmartCast>(a)).foo() and many other cases
This commit is contained in:
Denis.Zharkov
2021-01-27 19:51:14 +03:00
parent b3b1eb57ae
commit 5c62ee4ba8
45 changed files with 193 additions and 91 deletions
@@ -34894,6 +34894,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/smartCasts"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("complexExplicitReceiver.kt")
public void testComplexExplicitReceiver() throws Exception {
runTest("compiler/testData/codegen/box/smartCasts/complexExplicitReceiver.kt");
}
@Test
@TestMetadata("complexImplicitReceiver.kt")
public void testComplexImplicitReceiver() throws Exception {
@@ -280,31 +280,29 @@ class Fir2IrImplicitCastInserter(
return implicitCastOrExpression(data as IrExpression, expressionWithSmartcast.typeRef)
}
internal fun convertToImplicitCastExpression(
expressionWithSmartcast: FirExpressionWithSmartcast, calleeReference: FirReference
internal fun implicitCastFromDispatchReceiver(
original: IrExpression,
originalTypeRef: FirTypeRef,
calleeReference: FirReference,
): IrExpression {
val originalExpression = expressionWithSmartcast.originalExpression
val value = visitor.convertToIrExpression(originalExpression)
val typeRef = expressionWithSmartcast.typeRef
val referencedDeclaration =
((calleeReference as? FirResolvedNamedReference)?.resolvedSymbol as? FirCallableSymbol<*>)?.unwrapCallRepresentative()
?.fir as FirCallableMemberDeclaration<*>
?.fir as? FirCallableMemberDeclaration<*>
val dispatchReceiverType =
referencedDeclaration.dispatchReceiverType as? ConeClassLikeType
?: return implicitCastOrExpression(value, typeRef)
referencedDeclaration?.dispatchReceiverType as? ConeClassLikeType
?: return implicitCastOrExpression(original, originalTypeRef)
val starProjectedDispatchReceiver = dispatchReceiverType.replaceArgumentsWithStarProjections()
val castType = typeRef.coneTypeSafe<ConeIntersectionType>()
castType?.intersectedTypes?.forEach { type ->
if (AbstractTypeChecker.isSubtypeOf(session.typeContext, type, starProjectedDispatchReceiver)) {
return implicitCastOrExpression(value, type)
val castType = originalTypeRef.coneTypeSafe<ConeIntersectionType>()
castType?.intersectedTypes?.forEach { componentType ->
if (AbstractTypeChecker.isSubtypeOf(session.typeContext, componentType, starProjectedDispatchReceiver)) {
return implicitCastOrExpression(original, componentType)
}
}
return implicitCastOrExpression(value, typeRef)
return implicitCastOrExpression(original, originalTypeRef)
}
private fun implicitCastOrExpression(original: IrExpression, castType: ConeKotlinType): IrExpression {
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.fir.expressions.impl.FirStubStatement
import org.jetbrains.kotlin.fir.expressions.impl.FirUnitExpression
import org.jetbrains.kotlin.fir.references.FirReference
import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference
import org.jetbrains.kotlin.fir.references.FirSuperReference
import org.jetbrains.kotlin.fir.resolve.isIteratorNext
import org.jetbrains.kotlin.fir.resolve.toSymbol
import org.jetbrains.kotlin.fir.symbols.impl.*
@@ -476,10 +477,10 @@ class Fir2IrVisitor(
callableReferenceAccess: FirCallableReferenceAccess? = null
): IrExpression? {
return when (expression) {
null -> null
null -> return null
is FirResolvedQualifier -> callGenerator.convertToGetObject(expression, callableReferenceAccess)
is FirExpressionWithSmartcast -> implicitCastInserter.convertToImplicitCastExpression(expression, calleeReference)
is FirFunctionCall, is FirThisReceiverExpression, is FirCallableReferenceAccess -> convertToIrExpression(expression)
is FirFunctionCall, is FirThisReceiverExpression, is FirCallableReferenceAccess, is FirExpressionWithSmartcast ->
convertToIrExpression(expression)
else -> if (expression is FirQualifiedAccessExpression && expression.explicitReceiver == null) {
val variableAsFunctionMode = calleeReference is FirResolvedNamedReference &&
calleeReference.name != OperatorNameConventions.INVOKE &&
@@ -491,6 +492,10 @@ class Fir2IrVisitor(
} else {
convertToIrExpression(expression)
}
}?.run {
if (expression is FirQualifiedAccessExpression && expression.calleeReference is FirSuperReference) return@run this
implicitCastInserter.implicitCastFromDispatchReceiver(this, expression.typeRef, calleeReference)
}
}
@@ -0,0 +1,26 @@
abstract class A {
abstract fun o(): String
}
interface B {
fun k(): String
}
fun <T> id(x: T): T = x
fun foo(a: A?): String {
if (a is B) {
return id(a).o() + a!!.k()
}
return "fail"
}
class Impl : A(), B {
override fun o(): String = "O"
override fun k(): String = "K"
}
fun box(): String {
return foo(Impl())
}
@@ -7,7 +7,7 @@ fun test2(a: Any?): Int {
val tmp0_safe_receiver: Any? = a
when {
EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null
else -> tmp0_safe_receiver.hashCode()
else -> tmp0_safe_receiver /*as Any */.hashCode()
}
})
}
+2 -1
View File
@@ -24,7 +24,8 @@ FILE fqName:<root> fileName:/bangbang.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null
$this: GET_VAR 'val tmp_0: kotlin.Any? [val] declared in <root>.test2' type=kotlin.Any? origin=null
$this: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
GET_VAR 'val tmp_0: kotlin.Any? [val] declared in <root>.test2' type=kotlin.Any? origin=null
FUN name:test3 visibility:public modality:FINAL <X> (a:X of <root>.test3) returnType:X of <root>.test3
TYPE_PARAMETER name:X index:0 variance: superTypes:[kotlin.Any?]
VALUE_PARAMETER name:a index:0 type:X of <root>.test3
@@ -23,23 +23,22 @@ fun test(nc: C?): C? {
val tmp0_safe_receiver: C? = nc
when {
EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null
else -> tmp0_safe_receiver.foo()
else -> tmp0_safe_receiver /*as C */.foo()
}
}
when {
EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null
else -> tmp1_safe_receiver.bar()
else -> tmp1_safe_receiver /*as C */.bar()
}
}
when {
EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null
else -> tmp2_safe_receiver.foo()
else -> tmp2_safe_receiver /*as C */.foo()
}
}
when {
EQEQ(arg0 = tmp3_safe_receiver, arg1 = null) -> null
else -> tmp3_safe_receiver.foo()
else -> tmp3_safe_receiver /*as C */.foo()
}
}
}
@@ -50,7 +50,8 @@ FILE fqName:<root> fileName:/chainOfSafeCalls.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun foo (): <root>.C declared in <root>.C' type=<root>.C origin=null
$this: GET_VAR 'val tmp_3: <root>.C? [val] declared in <root>.test' type=<root>.C? origin=null
$this: TYPE_OP type=<root>.C origin=IMPLICIT_CAST typeOperand=<root>.C
GET_VAR 'val tmp_3: <root>.C? [val] declared in <root>.test' type=<root>.C? origin=null
WHEN type=<root>.C? origin=null
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
@@ -60,7 +61,8 @@ FILE fqName:<root> fileName:/chainOfSafeCalls.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun bar (): <root>.C? declared in <root>.C' type=<root>.C? origin=null
$this: GET_VAR 'val tmp_2: <root>.C? [val] declared in <root>.test' type=<root>.C? origin=null
$this: TYPE_OP type=<root>.C origin=IMPLICIT_CAST typeOperand=<root>.C
GET_VAR 'val tmp_2: <root>.C? [val] declared in <root>.test' type=<root>.C? origin=null
WHEN type=<root>.C? origin=null
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
@@ -70,7 +72,8 @@ FILE fqName:<root> fileName:/chainOfSafeCalls.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun foo (): <root>.C declared in <root>.C' type=<root>.C origin=null
$this: GET_VAR 'val tmp_1: <root>.C? [val] declared in <root>.test' type=<root>.C? origin=null
$this: TYPE_OP type=<root>.C origin=IMPLICIT_CAST typeOperand=<root>.C
GET_VAR 'val tmp_1: <root>.C? [val] declared in <root>.test' type=<root>.C? origin=null
WHEN type=<root>.C? origin=null
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
@@ -80,4 +83,5 @@ FILE fqName:<root> fileName:/chainOfSafeCalls.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun foo (): <root>.C declared in <root>.C' type=<root>.C origin=null
$this: GET_VAR 'val tmp_0: <root>.C? [val] declared in <root>.test' type=<root>.C? origin=null
$this: TYPE_OP type=<root>.C origin=IMPLICIT_CAST typeOperand=<root>.C
GET_VAR 'val tmp_0: <root>.C? [val] declared in <root>.test' type=<root>.C? origin=null
@@ -14,14 +14,14 @@ fun test3() {
val tmp0_safe_receiver: PrintStream? = #out
when {
EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null
else -> tmp0_safe_receiver.println(p0 = "Hello,")
else -> tmp0_safe_receiver /*as @FlexibleNullability PrintStream */.println(p0 = "Hello,")
}
} /*~> Unit */
{ // BLOCK
val tmp1_safe_receiver: PrintStream? = #out
when {
EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null
else -> tmp1_safe_receiver.println(p0 = "world!")
else -> tmp1_safe_receiver /*as @FlexibleNullability PrintStream */.println(p0 = "world!")
}
} /*~> Unit */
}
@@ -34,7 +34,8 @@ FILE fqName:<root> fileName:/coercionToUnit.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public open fun println (p0: kotlin.String?): kotlin.Unit declared in java.io.PrintStream' type=kotlin.Unit origin=null
$this: GET_VAR 'val tmp_0: java.io.PrintStream? [val] declared in <root>.test3' type=java.io.PrintStream? origin=null
$this: TYPE_OP type=@[FlexibleNullability] java.io.PrintStream origin=IMPLICIT_CAST typeOperand=@[FlexibleNullability] java.io.PrintStream
GET_VAR 'val tmp_0: java.io.PrintStream? [val] declared in <root>.test3' type=java.io.PrintStream? origin=null
p0: CONST String type=kotlin.String value="Hello,"
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Unit? origin=SAFE_CALL
@@ -49,5 +50,6 @@ FILE fqName:<root> fileName:/coercionToUnit.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public open fun println (p0: kotlin.String?): kotlin.Unit declared in java.io.PrintStream' type=kotlin.Unit origin=null
$this: GET_VAR 'val tmp_1: java.io.PrintStream? [val] declared in <root>.test3' type=java.io.PrintStream? origin=null
$this: TYPE_OP type=@[FlexibleNullability] java.io.PrintStream origin=IMPLICIT_CAST typeOperand=@[FlexibleNullability] java.io.PrintStream
GET_VAR 'val tmp_1: java.io.PrintStream? [val] declared in <root>.test3' type=java.io.PrintStream? origin=null
p0: CONST String type=kotlin.String value="world!"
@@ -7,8 +7,7 @@ fun lengthN(s: String?): Int? {
val tmp0_safe_receiver: String? = s
when {
EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null
else -> tmp0_safe_receiver.<get-length>()
else -> tmp0_safe_receiver /*as String */.<get-length>()
}
}
}
+2 -1
View File
@@ -21,4 +21,5 @@ FILE fqName:<root> fileName:/dotQualified.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public open fun <get-length> (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'val tmp_0: kotlin.String? [val] declared in <root>.lengthN' type=kotlin.String? origin=null
$this: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR 'val tmp_0: kotlin.String? [val] declared in <root>.lengthN' type=kotlin.String? origin=null
+2 -2
View File
@@ -15,14 +15,14 @@ fun test(x: X, nx: X?) {
val tmp0_safe_receiver: X? = nx
when {
EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null
else -> tmp0_safe_receiver.<get-xs>()
else -> tmp0_safe_receiver /*as X */.<get-xs>()
}
}).plusAssign<Int>(element = 5)
CHECK_NOT_NULL<MutableList<Any>>(arg0 = { // BLOCK
val tmp1_safe_receiver: X? = nx
when {
EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null
else -> tmp1_safe_receiver.f()
else -> tmp1_safe_receiver /*as X */.f()
}
}).plusAssign<Int>(element = 6)
}
+4 -2
View File
@@ -62,7 +62,8 @@ FILE fqName:<root> fileName:/kt30020.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public abstract fun <get-xs> (): kotlin.collections.MutableList<kotlin.Any> declared in <root>.X' type=kotlin.collections.MutableList<kotlin.Any> origin=GET_PROPERTY
$this: GET_VAR 'val tmp_0: <root>.X? [val] declared in <root>.test' type=<root>.X? origin=null
$this: TYPE_OP type=<root>.X origin=IMPLICIT_CAST typeOperand=<root>.X
GET_VAR 'val tmp_0: <root>.X? [val] declared in <root>.test' type=<root>.X? origin=null
element: CONST Int type=kotlin.Int value=5
CALL 'public final fun plusAssign <T> (element: T of kotlin.collections.CollectionsKt.plusAssign): kotlin.Unit [inline,operator] declared in kotlin.collections.CollectionsKt' type=kotlin.Unit origin=null
<T>: kotlin.Int
@@ -80,7 +81,8 @@ FILE fqName:<root> fileName:/kt30020.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public abstract fun f (): kotlin.collections.MutableList<kotlin.Any> declared in <root>.X' type=kotlin.collections.MutableList<kotlin.Any> origin=null
$this: GET_VAR 'val tmp_1: <root>.X? [val] declared in <root>.test' type=<root>.X? origin=null
$this: TYPE_OP type=<root>.X origin=IMPLICIT_CAST typeOperand=<root>.X
GET_VAR 'val tmp_1: <root>.X? [val] declared in <root>.test' type=<root>.X? origin=null
element: CONST Int type=kotlin.Int value=6
FUN name:testExtensionReceiver visibility:public modality:FINAL <> ($receiver:kotlin.collections.MutableList<kotlin.Any>) returnType:kotlin.Unit
$receiver: VALUE_PARAMETER name:<this> type:kotlin.collections.MutableList<kotlin.Any>
@@ -17,7 +17,7 @@ fun test(nc: C?) {
val tmp0_safe_receiver: C? = nc
when {
EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null
else -> tmp0_safe_receiver.<set-x>(<set-?> = 42)
else -> tmp0_safe_receiver /*as C */.<set-x>(<set-?> = 42)
}
} /*~> Unit */
}
@@ -54,5 +54,6 @@ FILE fqName:<root> fileName:/safeAssignment.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun <set-x> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>.C' type=kotlin.Unit origin=EQ
$this: GET_VAR 'val tmp_0: <root>.C? [val] declared in <root>.test' type=<root>.C? origin=null
$this: TYPE_OP type=<root>.C origin=IMPLICIT_CAST typeOperand=<root>.C
GET_VAR 'val tmp_0: <root>.C? [val] declared in <root>.test' type=<root>.C? origin=null
<set-?>: CONST Int type=kotlin.Int value=42
@@ -21,7 +21,7 @@ operator fun Int?.inc(): Int? {
val tmp0_safe_receiver: Int? = <this>
when {
EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null
else -> tmp0_safe_receiver.inc()
else -> tmp0_safe_receiver /*as Int */.inc()
}
}
}
@@ -38,14 +38,14 @@ fun testProperty(nc: C?) {
val tmp1_safe_receiver: C? = nc
when {
EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null
else -> tmp1_safe_receiver.<get-p>()
else -> tmp1_safe_receiver /*as C */.<get-p>()
}
}
{ // BLOCK
val tmp2_safe_receiver: C? = nc
when {
EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null
else -> tmp2_safe_receiver.<set-p>(value = <unary>.inc())
else -> tmp2_safe_receiver /*as C */.<set-p>(value = <unary>.inc())
}
} /*~> Unit */
<unary> /*~> Unit */
@@ -56,7 +56,7 @@ fun testArrayAccess(nc: C?) {
val tmp3_safe_receiver: C? = nc
when {
EQEQ(arg0 = tmp3_safe_receiver, arg1 = null) -> null
else -> tmp3_safe_receiver.<get-p>()
else -> tmp3_safe_receiver /*as C */.<get-p>()
}
}
val <index0>: Int = 0
@@ -46,7 +46,8 @@ FILE fqName:test fileName:/safeCallWithIncrementDecrement.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_VAR 'val tmp_0: kotlin.Int? [val] declared in test.inc' type=kotlin.Int? origin=null
$this: TYPE_OP type=kotlin.Int origin=IMPLICIT_CAST typeOperand=kotlin.Int
GET_VAR 'val tmp_0: kotlin.Int? [val] declared in test.inc' type=kotlin.Int? origin=null
FUN name:get visibility:public modality:FINAL <> ($receiver:kotlin.Int?, index:kotlin.Int) returnType:kotlin.Int [operator]
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Int?
VALUE_PARAMETER name:index index:0 type:kotlin.Int
@@ -74,7 +75,8 @@ FILE fqName:test fileName:/safeCallWithIncrementDecrement.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun <get-p> (): kotlin.Int declared in test' type=kotlin.Int origin=GET_PROPERTY
$receiver: GET_VAR 'val tmp_2: test.C? [val] declared in test.testProperty' type=test.C? origin=null
$receiver: TYPE_OP type=test.C origin=IMPLICIT_CAST typeOperand=test.C
GET_VAR 'val tmp_2: test.C? [val] declared in test.testProperty' type=test.C? origin=null
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Unit? origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:test.C? [val]
@@ -88,7 +90,8 @@ FILE fqName:test fileName:/safeCallWithIncrementDecrement.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun <set-p> (value: kotlin.Int): kotlin.Unit declared in test' type=kotlin.Unit origin=EQ
$receiver: GET_VAR 'val tmp_3: test.C? [val] declared in test.testProperty' type=test.C? origin=null
$receiver: TYPE_OP type=test.C origin=IMPLICIT_CAST typeOperand=test.C
GET_VAR 'val tmp_3: test.C? [val] declared in test.testProperty' type=test.C? origin=null
value: CALL 'public final fun inc (): kotlin.Int? [operator] declared in test' type=kotlin.Int? origin=null
$receiver: GET_VAR 'val tmp_1: kotlin.Int? [val] declared in test.testProperty' type=kotlin.Int? origin=null
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
@@ -109,7 +112,8 @@ FILE fqName:test fileName:/safeCallWithIncrementDecrement.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun <get-p> (): kotlin.Int declared in test' type=kotlin.Int origin=GET_PROPERTY
$receiver: GET_VAR 'val tmp_5: test.C? [val] declared in test.testArrayAccess' type=test.C? origin=null
$receiver: TYPE_OP type=test.C origin=IMPLICIT_CAST typeOperand=test.C
GET_VAR 'val tmp_5: test.C? [val] declared in test.testArrayAccess' type=test.C? origin=null
VAR IR_TEMPORARY_VARIABLE name:tmp_6 type:kotlin.Int [val]
CONST Int type=kotlin.Int value=0
VAR IR_TEMPORARY_VARIABLE name:tmp_7 type:kotlin.Int [val]
@@ -24,7 +24,7 @@ fun test1(x: String?): Int? {
val tmp0_safe_receiver: String? = x
when {
EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null
else -> tmp0_safe_receiver.<get-length>()
else -> tmp0_safe_receiver /*as String */.<get-length>()
}
}
}
@@ -34,7 +34,7 @@ fun test2(x: String?): Int? {
val tmp1_safe_receiver: String? = x
when {
EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null
else -> tmp1_safe_receiver.hashCode()
else -> tmp1_safe_receiver /*as String */.hashCode()
}
}
}
@@ -44,7 +44,7 @@ fun test3(x: String?, y: Any?): Boolean? {
val tmp2_safe_receiver: String? = x
when {
EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null
else -> tmp2_safe_receiver.equals(other = y)
else -> tmp2_safe_receiver /*as String */.equals(other = y)
}
}
}
@@ -54,7 +54,7 @@ fun test4(x: Ref?) {
val tmp3_safe_receiver: Ref? = x
when {
EQEQ(arg0 = tmp3_safe_receiver, arg1 = null) -> null
else -> tmp3_safe_receiver.<set-value>(<set-?> = 0)
else -> tmp3_safe_receiver /*as Ref */.<set-value>(<set-?> = 0)
}
} /*~> Unit */
}
@@ -64,7 +64,7 @@ fun IHost.test5(s: String?): Int? {
val tmp4_safe_receiver: String? = s
when {
EQEQ(arg0 = tmp4_safe_receiver, arg1 = null) -> null
else -> (<this>, tmp4_safe_receiver).extLength()
else -> (<this>, tmp4_safe_receiver /*as String */).extLength()
}
}
}
+10 -5
View File
@@ -76,7 +76,8 @@ FILE fqName:<root> fileName:/safeCalls.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public open fun <get-length> (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'val tmp_0: kotlin.String? [val] declared in <root>.test1' type=kotlin.String? origin=null
$this: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR 'val tmp_0: kotlin.String? [val] declared in <root>.test1' type=kotlin.String? origin=null
FUN name:test2 visibility:public modality:FINAL <> (x:kotlin.String?) returnType:kotlin.Int?
VALUE_PARAMETER name:x index:0 type:kotlin.String?
BLOCK_BODY
@@ -93,7 +94,8 @@ FILE fqName:<root> fileName:/safeCalls.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.String' type=kotlin.Int origin=null
$this: GET_VAR 'val tmp_1: kotlin.String? [val] declared in <root>.test2' type=kotlin.String? origin=null
$this: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR 'val tmp_1: kotlin.String? [val] declared in <root>.test2' type=kotlin.String? origin=null
FUN name:test3 visibility:public modality:FINAL <> (x:kotlin.String?, y:kotlin.Any?) returnType:kotlin.Boolean?
VALUE_PARAMETER name:x index:0 type:kotlin.String?
VALUE_PARAMETER name:y index:1 type:kotlin.Any?
@@ -111,7 +113,8 @@ FILE fqName:<root> fileName:/safeCalls.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in kotlin.String' type=kotlin.Boolean origin=null
$this: GET_VAR 'val tmp_2: kotlin.String? [val] declared in <root>.test3' type=kotlin.String? origin=null
$this: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR 'val tmp_2: kotlin.String? [val] declared in <root>.test3' type=kotlin.String? origin=null
other: GET_VAR 'y: kotlin.Any? declared in <root>.test3' type=kotlin.Any? origin=null
FUN name:test4 visibility:public modality:FINAL <> (x:<root>.Ref?) returnType:kotlin.Unit
VALUE_PARAMETER name:x index:0 type:<root>.Ref?
@@ -129,7 +132,8 @@ FILE fqName:<root> fileName:/safeCalls.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun <set-value> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>.Ref' type=kotlin.Unit origin=EQ
$this: GET_VAR 'val tmp_3: <root>.Ref? [val] declared in <root>.test4' type=<root>.Ref? origin=null
$this: TYPE_OP type=<root>.Ref origin=IMPLICIT_CAST typeOperand=<root>.Ref
GET_VAR 'val tmp_3: <root>.Ref? [val] declared in <root>.test4' type=<root>.Ref? origin=null
<set-?>: CONST Int type=kotlin.Int value=0
FUN name:test5 visibility:public modality:FINAL <> ($receiver:<root>.IHost, s:kotlin.String?) returnType:kotlin.Int?
$receiver: VALUE_PARAMETER name:<this> type:<root>.IHost
@@ -149,7 +153,8 @@ FILE fqName:<root> fileName:/safeCalls.kt
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public open fun extLength (): kotlin.Int declared in <root>.IHost' type=kotlin.Int origin=null
$this: GET_VAR '<this>: <root>.IHost declared in <root>.test5' type=<root>.IHost origin=null
$receiver: GET_VAR 'val tmp_4: kotlin.String? [val] declared in <root>.test5' type=kotlin.String? origin=null
$receiver: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR 'val tmp_4: kotlin.String? [val] declared in <root>.test5' type=kotlin.String? origin=null
FUN name:foo visibility:public modality:FINAL <> ($receiver:kotlin.Int) returnType:kotlin.Int
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Int
BLOCK_BODY
@@ -17,7 +17,7 @@ open enum class En : Enum<En> {
val tmp0_safe_receiver: Any? = <get-n>()
when {
EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null
else -> tmp0_safe_receiver.toString()
else -> tmp0_safe_receiver /*as Any */.toString()
}
})
@@ -42,7 +42,8 @@ FILE fqName:<root> fileName:/temporaryInEnumEntryInitializer.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null
$this: GET_VAR 'val tmp_0: kotlin.Any? [val] declared in <root>.En' type=kotlin.Any? origin=null
$this: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
GET_VAR 'val tmp_0: kotlin.Any? [val] declared in <root>.En' type=kotlin.Any? origin=null
FUN ENUM_CLASS_SPECIAL_MEMBER name:values visibility:public modality:FINAL <> () returnType:kotlin.Array<<root>.En>
SYNTHETIC_BODY kind=ENUM_VALUES
FUN ENUM_CLASS_SPECIAL_MEMBER name:valueOf visibility:public modality:FINAL <> (value:kotlin.String) returnType:<root>.En
@@ -13,10 +13,9 @@ class C {
val tmp0_safe_receiver: Any? = x
when {
EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null
else -> tmp0_safe_receiver.toString()
else -> tmp0_safe_receiver /*as Any */.toString()
}
}
}
}
@@ -31,7 +31,8 @@ FILE fqName:<root> fileName:/temporaryInInitBlock.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null
$this: GET_VAR 'val tmp_0: kotlin.Any? [val] declared in <root>.C' type=kotlin.Any? origin=null
$this: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
GET_VAR 'val tmp_0: kotlin.Any? [val] declared in <root>.C' type=kotlin.Any? origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
@@ -23,12 +23,12 @@ fun test4(ns: String?): String? {
val tmp0_safe_receiver: String? = ns
when {
EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null
else -> tmp0_safe_receiver.k()
else -> tmp0_safe_receiver /*as String */.k()
}
}
when {
EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null
else -> tmp1_safe_receiver.invoke()
else -> tmp1_safe_receiver /*as Function0<String> */.invoke()
}
}
}
@@ -45,7 +45,8 @@ FILE fqName:<root> fileName:/variableAsFunctionCall.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun k (): kotlin.Function0<kotlin.String> declared in <root>' type=kotlin.Function0<kotlin.String> origin=null
$receiver: GET_VAR 'val tmp_1: kotlin.String? [val] declared in <root>.test4' type=kotlin.String? origin=null
$receiver: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR 'val tmp_1: kotlin.String? [val] declared in <root>.test4' type=kotlin.String? origin=null
WHEN type=kotlin.String? origin=null
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
@@ -55,4 +56,5 @@ FILE fqName:<root> fileName:/variableAsFunctionCall.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public abstract fun invoke (): R of kotlin.Function0 [operator] declared in kotlin.Function0' type=kotlin.String origin=INVOKE
$this: GET_VAR 'val tmp_0: kotlin.Function0<kotlin.String>? [val] declared in <root>.test4' type=kotlin.Function0<kotlin.String>? origin=null
$this: TYPE_OP type=kotlin.Function0<kotlin.String> origin=IMPLICIT_CAST typeOperand=kotlin.Function0<kotlin.String>
GET_VAR 'val tmp_0: kotlin.Function0<kotlin.String>? [val] declared in <root>.test4' type=kotlin.Function0<kotlin.String>? origin=null
@@ -79,7 +79,7 @@ fun box(): String {
val tmp0_safe_receiver: ImplicitReceiverValue<*>? = stack.get(name = null)
when {
EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null
else -> tmp0_safe_receiver.<get-type>()
else -> tmp0_safe_receiver /*as ImplicitReceiverValue<*> */.<get-type>()
}
})
}
@@ -249,4 +249,5 @@ FILE fqName:<root> fileName:/ImplicitReceiverStack.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun <get-type> (): kotlin.String declared in <root>.ImplicitReceiverValue' type=kotlin.String origin=GET_PROPERTY
$this: GET_VAR 'val tmp_0: <root>.ImplicitReceiverValue<*>? [val] declared in <root>.box' type=<root>.ImplicitReceiverValue<*>? origin=null
$this: TYPE_OP type=<root>.ImplicitReceiverValue<*> origin=IMPLICIT_CAST typeOperand=<root>.ImplicitReceiverValue<*>
GET_VAR 'val tmp_0: <root>.ImplicitReceiverValue<*>? [val] declared in <root>.box' type=<root>.ImplicitReceiverValue<*>? origin=null
+1 -1
View File
@@ -13,7 +13,7 @@ class Owner<out T : JCTree> {
get(): String {
var tree: JCTree = <this>.<get-tree>()
when {
tree /*as T */ is JCTypeApply -> return tree /*as JCTypeApply */.#clazz /*!! String */
tree /*as T */ is JCTypeApply -> return tree /*as T */ /*as JCTypeApply */.#clazz /*!! String */
}
return ""
}
+2 -1
View File
@@ -35,7 +35,8 @@ FILE fqName:<root> fileName:/JCTreeUser.kt
TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:clazz type:kotlin.String? visibility:public' type=kotlin.String? origin=GET_PROPERTY
receiver: TYPE_OP type=<root>.JCTree.JCTypeApply origin=IMPLICIT_CAST typeOperand=<root>.JCTree.JCTypeApply
GET_VAR 'var tree: <root>.JCTree [var] declared in <root>.Owner.<get-foo>' type=<root>.JCTree origin=null
TYPE_OP type=T of <root>.Owner origin=IMPLICIT_CAST typeOperand=T of <root>.Owner
GET_VAR 'var tree: <root>.JCTree [var] declared in <root>.Owner.<get-foo>' type=<root>.JCTree origin=null
RETURN type=kotlin.Nothing from='public final fun <get-foo> (): kotlin.String declared in <root>.Owner'
CONST String type=kotlin.String value=""
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
@@ -10,7 +10,7 @@ private fun Reader.nextChar(): Char? {
)
when {
EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null
else -> tmp0_safe_receiver.toChar()
else -> tmp0_safe_receiver /*as Int */.toChar()
}
}
}
@@ -26,7 +26,7 @@ fun Reader.consumeRestOfQuotedSequence(sb: StringBuilder, quote: Char) {
val tmp1_safe_receiver: Char? = <this>.nextChar()
when {
EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null
else -> tmp1_safe_receiver.let<Char, StringBuilder?>(block = local fun <anonymous>(it: Char): StringBuilder? {
else -> tmp1_safe_receiver /*as Char */.let<Char, StringBuilder?>(block = local fun <anonymous>(it: Char): StringBuilder? {
return sb.append(p0 = it)
}
)
@@ -35,7 +35,8 @@ FILE fqName:<root> fileName:/coercionToUnitForNestedWhen.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public open fun toChar (): kotlin.Char declared in kotlin.Int' type=kotlin.Char origin=null
$this: GET_VAR 'val tmp_0: kotlin.Int? [val] declared in <root>.nextChar' type=kotlin.Int? origin=null
$this: TYPE_OP type=kotlin.Int origin=IMPLICIT_CAST typeOperand=kotlin.Int
GET_VAR 'val tmp_0: kotlin.Int? [val] declared in <root>.nextChar' type=kotlin.Int? origin=null
FUN name:consumeRestOfQuotedSequence visibility:public modality:FINAL <> ($receiver:java.io.Reader, sb:java.lang.StringBuilder, quote:kotlin.Char) returnType:kotlin.Unit
$receiver: VALUE_PARAMETER name:<this> type:java.io.Reader
VALUE_PARAMETER name:sb index:0 type:java.lang.StringBuilder
@@ -82,7 +83,8 @@ FILE fqName:<root> fileName:/coercionToUnitForNestedWhen.kt
then: CALL 'public final fun let <T, R> (block: kotlin.Function1<T of kotlin.StandardKt.let, R of kotlin.StandardKt.let>): R of kotlin.StandardKt.let [inline] declared in kotlin.StandardKt' type=java.lang.StringBuilder? origin=null
<T>: kotlin.Char
<R>: java.lang.StringBuilder?
$receiver: GET_VAR 'val tmp_1: kotlin.Char? [val] declared in <root>.consumeRestOfQuotedSequence' type=kotlin.Char? origin=null
$receiver: TYPE_OP type=kotlin.Char origin=IMPLICIT_CAST typeOperand=kotlin.Char
GET_VAR 'val tmp_1: kotlin.Char? [val] declared in <root>.consumeRestOfQuotedSequence' type=kotlin.Char? origin=null
block: FUN_EXPR type=kotlin.Function1<kotlin.Char, java.lang.StringBuilder?> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:kotlin.Char) returnType:java.lang.StringBuilder?
VALUE_PARAMETER name:it index:0 type:kotlin.Char
@@ -108,7 +108,7 @@ val <T : Any?> Value<T, CR<T>>.additionalText: P<T, T> /* by */
<no name provided>()
}
get(): T {
return <this>.#deepO$delegate.getValue(t = <this>, p = <no name provided>::deepO)
return <this> /*as <no name provided> */.#deepO$delegate.getValue(t = <this>, p = <no name provided>::deepO)
}
private val Value<T, CR<T>>.deepK: T /* by */
@@ -129,7 +129,7 @@ val <T : Any?> Value<T, CR<T>>.additionalText: P<T, T> /* by */
<no name provided>()
}
get(): T {
return <this>.#deepK$delegate.getValue(t = <this>, p = <no name provided>::deepK)
return <this> /*as <no name provided> */.#deepK$delegate.getValue(t = <this>, p = <no name provided>::deepK)
}
override operator fun getValue(t: Value<T, CR<T>>, p: KProperty<*>): P<T, T> {
@@ -279,7 +279,8 @@ FILE fqName:<root> fileName:/genericDelegatedDeepProperty.kt
RETURN type=kotlin.Nothing from='public final fun <get-deepO> (): T of <root>.<get-additionalText> declared in <root>.additionalText$delegate.<no name provided>'
CALL 'public final fun getValue (t: <root>.Value<T of <root>.<get-additionalText>, <root>.CR<T of <root>.<get-additionalText>>>, p: kotlin.reflect.KProperty<*>): T of <root>.<get-additionalText> [operator] declared in <root>.additionalText$delegate.<no name provided>.deepO$delegate.<no name provided>' type=T of <root>.<get-additionalText> origin=null
$this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:deepO$delegate type:<root>.additionalText$delegate.<no name provided>.deepO$delegate.<no name provided><T of <root>.<get-additionalText>> visibility:private [final]' type=<root>.additionalText$delegate.<no name provided>.deepO$delegate.<no name provided><T of <root>.<get-additionalText>> origin=null
receiver: GET_VAR '<this>: <root>.additionalText$delegate.<no name provided><T of <root>.<get-additionalText>> declared in <root>.additionalText$delegate.<no name provided>.<get-deepO>' type=<root>.additionalText$delegate.<no name provided><T of <root>.<get-additionalText>> origin=null
receiver: TYPE_OP type=<root>.additionalText$delegate.<no name provided> origin=IMPLICIT_CAST typeOperand=<root>.additionalText$delegate.<no name provided>
GET_VAR '<this>: <root>.additionalText$delegate.<no name provided><T of <root>.<get-additionalText>> declared in <root>.additionalText$delegate.<no name provided>.<get-deepO>' type=<root>.additionalText$delegate.<no name provided><T of <root>.<get-additionalText>> origin=null
t: GET_VAR '<this>: <root>.additionalText$delegate.<no name provided><T of <root>.<get-additionalText>> declared in <root>.additionalText$delegate.<no name provided>.<get-deepO>' type=<root>.additionalText$delegate.<no name provided><T of <root>.<get-additionalText>> origin=null
p: PROPERTY_REFERENCE 'private final deepO: T of <root>.<get-additionalText> [delegated,val]' field=null getter='public final fun <get-deepO> (): T of <root>.<get-additionalText> declared in <root>.additionalText$delegate.<no name provided>' setter=null type=kotlin.reflect.KProperty2<<root>.Value<T of <root>.<get-additionalText>, <root>.CR<T of <root>.<get-additionalText>>>, *, T of <root>.<get-additionalText>> origin=PROPERTY_REFERENCE_FOR_DELEGATE
PROPERTY name:deepK visibility:private modality:FINAL [delegated,val]
@@ -325,7 +326,8 @@ FILE fqName:<root> fileName:/genericDelegatedDeepProperty.kt
RETURN type=kotlin.Nothing from='public final fun <get-deepK> (): T of <root>.<get-additionalText> declared in <root>.additionalText$delegate.<no name provided>'
CALL 'public final fun getValue (t: <root>.Value<T of <root>.<get-additionalText>, <root>.CR<T of <root>.<get-additionalText>>>, p: kotlin.reflect.KProperty<*>): T of <root>.<get-additionalText> [operator] declared in <root>.additionalText$delegate.<no name provided>.deepK$delegate.<no name provided>' type=T of <root>.<get-additionalText> origin=null
$this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:deepK$delegate type:<root>.additionalText$delegate.<no name provided>.deepK$delegate.<no name provided><T of <root>.<get-additionalText>> visibility:private [final]' type=<root>.additionalText$delegate.<no name provided>.deepK$delegate.<no name provided><T of <root>.<get-additionalText>> origin=null
receiver: GET_VAR '<this>: <root>.additionalText$delegate.<no name provided><T of <root>.<get-additionalText>> declared in <root>.additionalText$delegate.<no name provided>.<get-deepK>' type=<root>.additionalText$delegate.<no name provided><T of <root>.<get-additionalText>> origin=null
receiver: TYPE_OP type=<root>.additionalText$delegate.<no name provided> origin=IMPLICIT_CAST typeOperand=<root>.additionalText$delegate.<no name provided>
GET_VAR '<this>: <root>.additionalText$delegate.<no name provided><T of <root>.<get-additionalText>> declared in <root>.additionalText$delegate.<no name provided>.<get-deepK>' type=<root>.additionalText$delegate.<no name provided><T of <root>.<get-additionalText>> origin=null
t: GET_VAR '<this>: <root>.additionalText$delegate.<no name provided><T of <root>.<get-additionalText>> declared in <root>.additionalText$delegate.<no name provided>.<get-deepK>' type=<root>.additionalText$delegate.<no name provided><T of <root>.<get-additionalText>> origin=null
p: PROPERTY_REFERENCE 'private final deepK: T of <root>.<get-additionalText> [delegated,val]' field=null getter='public final fun <get-deepK> (): T of <root>.<get-additionalText> declared in <root>.additionalText$delegate.<no name provided>' setter=null type=kotlin.reflect.KProperty2<<root>.Value<T of <root>.<get-additionalText>, <root>.CR<T of <root>.<get-additionalText>>>, *, T of <root>.<get-additionalText>> origin=PROPERTY_REFERENCE_FOR_DELEGATE
FUN name:getValue visibility:public modality:FINAL <> ($this:<root>.additionalText$delegate.<no name provided><T of <root>.<get-additionalText>>, t:<root>.Value<T of <root>.<get-additionalText>, <root>.CR<T of <root>.<get-additionalText>>>, p:kotlin.reflect.KProperty<*>) returnType:<root>.P<T of <root>.<get-additionalText>, T of <root>.<get-additionalText>> [operator]
@@ -17,7 +17,7 @@ var <T : Any?> C<T>.y: T
return <this>.<get-x>()
}
set(v: T) {
<this>.<set-x>(<set-?> = v)
<this> /*as C<T> */.<set-x>(<set-?> = v)
}
fun use(p: KMutableProperty<String>) {
@@ -55,7 +55,8 @@ FILE fqName:<root> fileName:/genericPropertyReferenceType.kt
VALUE_PARAMETER name:v index:0 type:T of <root>.<get-y>
BLOCK_BODY
CALL 'public final fun <set-x> (<set-?>: T of <root>.C): kotlin.Unit declared in <root>.C' type=kotlin.Unit origin=EQ
$this: GET_VAR '<this>: <root>.C<T of <root>.<set-y>> declared in <root>.<set-y>' type=<root>.C<T of <root>.<set-y>> origin=null
$this: TYPE_OP type=<root>.C<T of <root>.<get-y>> origin=IMPLICIT_CAST typeOperand=<root>.C<T of <root>.<get-y>>
GET_VAR '<this>: <root>.C<T of <root>.<set-y>> declared in <root>.<set-y>' type=<root>.C<T of <root>.<set-y>> origin=null
<set-?>: GET_VAR 'v: T of <root>.<get-y> declared in <root>.<set-y>' type=T of <root>.<get-y> origin=null
FUN name:use visibility:public modality:FINAL <> (p:kotlin.reflect.KMutableProperty<kotlin.String>) returnType:kotlin.Unit
VALUE_PARAMETER name:p index:0 type:kotlin.reflect.KMutableProperty<kotlin.String>
@@ -25,8 +25,8 @@ interface IB {
fun test(a: In<IA>, b: In<IB>, z: Z) {
z.create<IA>(x = a, y = b).<get-t>().foo()
z.create<IA>(x = a, y = b).<get-t>().bar()
z.create<IA>(x = a, y = b).<get-t>() /*as IB */.bar()
val t: IA = z.create<IA>(x = a, y = b).<get-t>()
t.foo()
t.bar()
t /*as IB */.bar()
}
@@ -102,12 +102,13 @@ FILE fqName:<root> fileName:/localVariableOfIntersectionType_NI.kt
x: GET_VAR 'a: <root>.In<<root>.IA> declared in <root>.test' type=<root>.In<<root>.IA> origin=null
y: GET_VAR 'b: <root>.In<<root>.IB> declared in <root>.test' type=<root>.In<<root>.IB> origin=null
CALL 'public abstract fun bar (): kotlin.Unit declared in <root>.IB' type=kotlin.Unit origin=null
$this: CALL 'public abstract fun <get-t> (): T of <root>.Inv declared in <root>.Inv' type=<root>.IA origin=GET_PROPERTY
$this: CALL 'public abstract fun create <T> (x: <root>.In<T of <root>.Z.create>, y: <root>.In<T of <root>.Z.create>): <root>.Inv<T of <root>.Z.create> declared in <root>.Z' type=<root>.Inv<<root>.IA> origin=null
<T>: <root>.IA
$this: GET_VAR 'z: <root>.Z declared in <root>.test' type=<root>.Z origin=null
x: GET_VAR 'a: <root>.In<<root>.IA> declared in <root>.test' type=<root>.In<<root>.IA> origin=null
y: GET_VAR 'b: <root>.In<<root>.IB> declared in <root>.test' type=<root>.In<<root>.IB> origin=null
$this: TYPE_OP type=<root>.IB origin=IMPLICIT_CAST typeOperand=<root>.IB
CALL 'public abstract fun <get-t> (): T of <root>.Inv declared in <root>.Inv' type=<root>.IA origin=GET_PROPERTY
$this: CALL 'public abstract fun create <T> (x: <root>.In<T of <root>.Z.create>, y: <root>.In<T of <root>.Z.create>): <root>.Inv<T of <root>.Z.create> declared in <root>.Z' type=<root>.Inv<<root>.IA> origin=null
<T>: <root>.IA
$this: GET_VAR 'z: <root>.Z declared in <root>.test' type=<root>.Z origin=null
x: GET_VAR 'a: <root>.In<<root>.IA> declared in <root>.test' type=<root>.In<<root>.IA> origin=null
y: GET_VAR 'b: <root>.In<<root>.IB> declared in <root>.test' type=<root>.In<<root>.IB> origin=null
VAR name:t type:<root>.IA [val]
CALL 'public abstract fun <get-t> (): T of <root>.Inv declared in <root>.Inv' type=<root>.IA origin=GET_PROPERTY
$this: CALL 'public abstract fun create <T> (x: <root>.In<T of <root>.Z.create>, y: <root>.In<T of <root>.Z.create>): <root>.Inv<T of <root>.Z.create> declared in <root>.Z' type=<root>.Inv<<root>.IA> origin=null
@@ -118,4 +119,5 @@ FILE fqName:<root> fileName:/localVariableOfIntersectionType_NI.kt
CALL 'public abstract fun foo (): kotlin.Unit declared in <root>.IA' type=kotlin.Unit origin=null
$this: GET_VAR 'val t: <root>.IA [val] declared in <root>.test' type=<root>.IA origin=null
CALL 'public abstract fun bar (): kotlin.Unit declared in <root>.IB' type=kotlin.Unit origin=null
$this: GET_VAR 'val t: <root>.IA [val] declared in <root>.test' type=<root>.IA origin=null
$this: TYPE_OP type=<root>.IB origin=IMPLICIT_CAST typeOperand=<root>.IB
GET_VAR 'val t: <root>.IA [val] declared in <root>.test' type=<root>.IA origin=null
@@ -35094,6 +35094,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/smartCasts"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@Test
@TestMetadata("complexExplicitReceiver.kt")
public void testComplexExplicitReceiver() throws Exception {
runTest("compiler/testData/codegen/box/smartCasts/complexExplicitReceiver.kt");
}
@Test
@TestMetadata("complexImplicitReceiver.kt")
public void testComplexImplicitReceiver() throws Exception {
@@ -34894,6 +34894,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/smartCasts"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("complexExplicitReceiver.kt")
public void testComplexExplicitReceiver() throws Exception {
runTest("compiler/testData/codegen/box/smartCasts/complexExplicitReceiver.kt");
}
@Test
@TestMetadata("complexImplicitReceiver.kt")
public void testComplexImplicitReceiver() throws Exception {
@@ -28666,6 +28666,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/smartCasts"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@TestMetadata("complexExplicitReceiver.kt")
public void testComplexExplicitReceiver() throws Exception {
runTest("compiler/testData/codegen/box/smartCasts/complexExplicitReceiver.kt");
}
@TestMetadata("complexImplicitReceiver.kt")
public void testComplexImplicitReceiver() throws Exception {
runTest("compiler/testData/codegen/box/smartCasts/complexImplicitReceiver.kt");
@@ -24792,6 +24792,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/smartCasts"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
}
@TestMetadata("complexExplicitReceiver.kt")
public void testComplexExplicitReceiver() throws Exception {
runTest("compiler/testData/codegen/box/smartCasts/complexExplicitReceiver.kt");
}
@TestMetadata("complexImplicitReceiver.kt")
public void testComplexImplicitReceiver() throws Exception {
runTest("compiler/testData/codegen/box/smartCasts/complexImplicitReceiver.kt");
@@ -24792,6 +24792,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/smartCasts"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@TestMetadata("complexExplicitReceiver.kt")
public void testComplexExplicitReceiver() throws Exception {
runTest("compiler/testData/codegen/box/smartCasts/complexExplicitReceiver.kt");
}
@TestMetadata("complexImplicitReceiver.kt")
public void testComplexImplicitReceiver() throws Exception {
runTest("compiler/testData/codegen/box/smartCasts/complexImplicitReceiver.kt");
@@ -24757,6 +24757,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/smartCasts"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
}
@TestMetadata("complexExplicitReceiver.kt")
public void testComplexExplicitReceiver() throws Exception {
runTest("compiler/testData/codegen/box/smartCasts/complexExplicitReceiver.kt");
}
@TestMetadata("complexImplicitReceiver.kt")
public void testComplexImplicitReceiver() throws Exception {
runTest("compiler/testData/codegen/box/smartCasts/complexImplicitReceiver.kt");
@@ -13261,6 +13261,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/smartCasts"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
}
@TestMetadata("complexExplicitReceiver.kt")
public void testComplexExplicitReceiver() throws Exception {
runTest("compiler/testData/codegen/box/smartCasts/complexExplicitReceiver.kt");
}
@TestMetadata("complexImplicitReceiver.kt")
public void testComplexImplicitReceiver() throws Exception {
runTest("compiler/testData/codegen/box/smartCasts/complexImplicitReceiver.kt");