From b64b32e06b2063607018bd18e3a1de3f4db2cca6 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 17 Sep 2020 14:03:04 +0300 Subject: [PATCH] FIR: keep captured types in substitution scope --- .../testData/resolve/cfg/complex.dot | 2 +- .../testData/resolve/cfg/complex.txt | 2 +- .../resolve/cfg/flowFromInplaceLambda.dot | 4 +- .../resolve/cfg/flowFromInplaceLambda.txt | 2 +- .../expresssions/genericDescriptor.txt | 2 +- .../inference/nestedExtensionFunctionType.txt | 2 +- .../resolve/inference/simpleCapturedTypes.txt | 6 +-- .../references/referenceToExtension.txt | 4 +- .../resolve/typeAliasWithTypeArguments.txt | 6 +-- .../resolve/varargInPrimaryConstructor.txt | 4 +- .../resolveWithStdlib/arrayFirstOrNull.txt | 2 +- .../scopes/impl/FirClassSubstitutionScope.kt | 28 +++--------- .../box/javaInterop/genericSamProjectedOut.kt | 1 - .../genericSamProjectedOutWithNewInference.kt | 1 - .../box/javaInterop/genericSamSmartcast.kt | 1 - .../samAdapters/GenericClass.fir.kt | 2 +- .../GenericMethodInGenericClass.fir.kt | 2 +- .../sam/genericSamProjectedOut.fir.txt | 45 +++++++++++-------- .../sam/genericSamSmartcast.fir.txt | 17 ++++--- 19 files changed, 64 insertions(+), 69 deletions(-) diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/complex.dot b/compiler/fir/analysis-tests/testData/resolve/cfg/complex.dot index e09dd9ad03f..022e4c2c93a 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/complex.dot +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/complex.dot @@ -191,7 +191,7 @@ digraph complex_kt { color=blue 56 [label="Enter block"]; 57 [label="Access variable this@R|/firstIsInstanceOrNull|"]; - 58 [label="Function call: this@R|/firstIsInstanceOrNull|.R|FakeOverride|>|()"]; + 58 [label="Function call: this@R|/firstIsInstanceOrNull|.R|FakeOverride|>|()"]; 59 [label="Variable declaration: lval : R|kotlin/collections/Iterator|"]; subgraph cluster_20 { color=blue diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/complex.txt b/compiler/fir/analysis-tests/testData/resolve/cfg/complex.txt index b041f495df3..a2016e5403d 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/complex.txt +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/complex.txt @@ -25,7 +25,7 @@ FILE: complex.kt } public final inline fun R|kotlin/collections/List<*>|.firstIsInstanceOrNull(): R|T?| { - lval : R|kotlin/collections/Iterator| = this@R|/firstIsInstanceOrNull|.R|FakeOverride|>|() + lval : R|kotlin/collections/Iterator| = this@R|/firstIsInstanceOrNull|.R|FakeOverride|>|() while(R|/|.R|kotlin/collections/Iterator.hasNext|()) { lval element: R|kotlin/Any?| = R|/|.R|FakeOverride|() when () { diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromInplaceLambda.dot b/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromInplaceLambda.dot index 2a111b57af8..83866f3eaad 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromInplaceLambda.dot +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromInplaceLambda.dot @@ -25,8 +25,8 @@ digraph flowFromInplaceLambda_kt { 5 [label="Enter block"]; 6 [label="Access variable R|/x|"]; 7 [label="Const: Int(0)"]; - 8 [label="Function call: R|/x|.R|FakeOverride|(...)"]; - 9 [label="Jump: ^select R|/x|.R|FakeOverride|(Int(0))"]; + 8 [label="Function call: R|/x|.R|FakeOverride|(...)"]; + 9 [label="Jump: ^select R|/x|.R|FakeOverride|(Int(0))"]; 10 [label="Stub" style="filled" fillcolor=gray]; 11 [label="Exit block" style="filled" fillcolor=gray]; } diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromInplaceLambda.txt b/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromInplaceLambda.txt index e0ca27481e1..b32220c0e42 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromInplaceLambda.txt +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromInplaceLambda.txt @@ -2,7 +2,7 @@ FILE: flowFromInplaceLambda.kt public final fun takeInt(x: R|kotlin/Int|): R|kotlin/Unit| { } public final fun select(vararg x: R|kotlin/Array|): R|K| { - ^select R|/x|.R|FakeOverride|(Int(0)) + ^select R|/x|.R|FakeOverride|(Int(0)) } public final fun id(x: R|T|): R|T| { ^id R|/x| diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/genericDescriptor.txt b/compiler/fir/analysis-tests/testData/resolve/expresssions/genericDescriptor.txt index f72a1162468..4d2c9cb4251 100644 --- a/compiler/fir/analysis-tests/testData/resolve/expresssions/genericDescriptor.txt +++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/genericDescriptor.txt @@ -24,6 +24,6 @@ FILE: test.kt R|/resolvedDescriptor|.R|/foo|() } public final fun otherTest(call: R|Call<*>|, resolvedCall: R|ResolvedCall<*>|): R|kotlin/Unit| { - R|/call|.R|FakeOverride|.R|/name| + R|/call|.R|FakeOverride|.R|/name| R|/resolvedCall|.R|/ResolvedCall.resultingDescriptor|.R|/name| } diff --git a/compiler/fir/analysis-tests/testData/resolve/inference/nestedExtensionFunctionType.txt b/compiler/fir/analysis-tests/testData/resolve/inference/nestedExtensionFunctionType.txt index 202a7b253ca..d300044a22d 100644 --- a/compiler/fir/analysis-tests/testData/resolve/inference/nestedExtensionFunctionType.txt +++ b/compiler/fir/analysis-tests/testData/resolve/inference/nestedExtensionFunctionType.txt @@ -13,7 +13,7 @@ FILE: nestedExtensionFunctionType.kt } public final fun test_2(a: R|A|, vararg zs: @R|kotlin/ExtensionFunctionType|() R|kotlin/Array>|): R|kotlin/Unit| { - lval : R|kotlin/collections/Iterator>| = R|/zs|.R|FakeOverride>|>|() + lval : R|kotlin/collections/Iterator>| = R|/zs|.R|FakeOverride)>|>|() while(R|/|.R|kotlin/collections/Iterator.hasNext|()) { lval z: R|(A) -> kotlin/Unit| = R|/|.R|FakeOverride kotlin/Unit|>|() R|/z|.R|FakeOverride|(R|/a|) diff --git a/compiler/fir/analysis-tests/testData/resolve/inference/simpleCapturedTypes.txt b/compiler/fir/analysis-tests/testData/resolve/inference/simpleCapturedTypes.txt index ebf330ef599..c36de9be75a 100644 --- a/compiler/fir/analysis-tests/testData/resolve/inference/simpleCapturedTypes.txt +++ b/compiler/fir/analysis-tests/testData/resolve/inference/simpleCapturedTypes.txt @@ -19,9 +19,9 @@ FILE: simpleCapturedTypes.kt ^ this@R|/idP| } private final fun getSetterInfos(kc: R|KC|): R|kotlin/Unit| { - R|/id|(R|/kc|).R|FakeOverride|.R|/Ann.foo|() - R|/kc|.R|/idR|().R|FakeOverride|.R|/Ann.foo|() - R|/kc|.R|/idP|.R|FakeOverride|.R|/Ann.foo|() + R|/id|(R|/kc|).R|FakeOverride|.R|/Ann.foo|() + R|/kc|.R|/idR|().R|FakeOverride|.R|/Ann.foo|() + R|/kc|.R|/idP|.R|FakeOverride|.R|/Ann.foo|() lval x1: R|KC| = R|/id|(R|/kc|) lval x2: R|KC| = R|/kc|.R|/idR|() lval x3: R|KC| = R|/kc|.R|/idP| diff --git a/compiler/fir/analysis-tests/testData/resolve/references/referenceToExtension.txt b/compiler/fir/analysis-tests/testData/resolve/references/referenceToExtension.txt index 0d0ef4dc4ce..87e94295229 100644 --- a/compiler/fir/analysis-tests/testData/resolve/references/referenceToExtension.txt +++ b/compiler/fir/analysis-tests/testData/resolve/references/referenceToExtension.txt @@ -35,8 +35,8 @@ FILE: referenceToExtension.kt } public final fun test_1(): R|kotlin/Unit| { - lval memberValRef: R|kotlin/reflect/KProperty1, GenericTest.A>| = Q|GenericTest.B|::R|FakeOverride|>| - lval memberFunRef: R|kotlin/reflect/KFunction1, GenericTest.A>| = Q|GenericTest.B|::R|FakeOverride|>| + lval memberValRef: R|kotlin/reflect/KProperty1, GenericTest.A>| = Q|GenericTest.B|::R|FakeOverride|>| + lval memberFunRef: R|kotlin/reflect/KFunction1, GenericTest.A>| = Q|GenericTest.B|::R|FakeOverride|>| } public final fun test_2(): R|kotlin/Unit| { diff --git a/compiler/fir/analysis-tests/testData/resolve/typeAliasWithTypeArguments.txt b/compiler/fir/analysis-tests/testData/resolve/typeAliasWithTypeArguments.txt index 75808e54f0d..791e4be26b4 100644 --- a/compiler/fir/analysis-tests/testData/resolve/typeAliasWithTypeArguments.txt +++ b/compiler/fir/analysis-tests/testData/resolve/typeAliasWithTypeArguments.txt @@ -73,12 +73,12 @@ FILE: typeAliasWithTypeArguments.kt public final fun test_6(a: R|A|, out1: R|Out1|, out2: R|Out1|, out3: R|Out1|): R|kotlin/Unit| { R|/out1|.R|FakeOverride|().R|/A.foo|() R|/out2|.#().#() - R|/out3|.R|FakeOverride|().R|/A.foo|() + R|/out3|.R|FakeOverride|().R|/A.foo|() } public final fun test_7(a: R|A|, inv1: R|Invariant1|, inv2: R|Invariant1|, inv3: R|Invariant1|): R|kotlin/Unit| { R|/inv1|.R|FakeOverride|().R|/A.foo|() - R|/inv2|.R|FakeOverride|().#() - R|/inv3|.R|FakeOverride|().R|/A.foo|() + R|/inv2|.R|FakeOverride|().#() + R|/inv3|.R|FakeOverride|().R|/A.foo|() R|/inv1|.R|FakeOverride|(R|/a|) R|/inv2|.R|FakeOverride|(R|/a|) R|/inv3|.#(R|/a|) diff --git a/compiler/fir/analysis-tests/testData/resolve/varargInPrimaryConstructor.txt b/compiler/fir/analysis-tests/testData/resolve/varargInPrimaryConstructor.txt index eb2b64e4d48..6507993c4bc 100644 --- a/compiler/fir/analysis-tests/testData/resolve/varargInPrimaryConstructor.txt +++ b/compiler/fir/analysis-tests/testData/resolve/varargInPrimaryConstructor.txt @@ -9,7 +9,7 @@ FILE: varargInPrimaryConstructor.kt } public final fun test_1(foo: R|Foo|): R|kotlin/Unit| { - lval : R|kotlin/collections/Iterator| = R|/foo|.R|/Foo.strings|.R|FakeOverride|>|() + lval : R|kotlin/collections/Iterator| = R|/foo|.R|/Foo.strings|.R|FakeOverride|>|() while(R|/|.R|kotlin/collections/Iterator.hasNext|()) { lval s: R|kotlin/String| = R|/|.R|FakeOverride|() R|/s|.R|kotlin/String.length| @@ -17,7 +17,7 @@ FILE: varargInPrimaryConstructor.kt } public final fun test_2(vararg strings: R|kotlin/Array|): R|kotlin/Unit| { - lval : R|kotlin/collections/Iterator| = R|/strings|.R|FakeOverride|>|() + lval : R|kotlin/collections/Iterator| = R|/strings|.R|FakeOverride|>|() while(R|/|.R|kotlin/collections/Iterator.hasNext|()) { lval s: R|kotlin/String| = R|/|.R|FakeOverride|() R|/s|.R|kotlin/String.length| diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/arrayFirstOrNull.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/arrayFirstOrNull.txt index 16bb8964abd..12e7d7aee09 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/arrayFirstOrNull.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/arrayFirstOrNull.txt @@ -13,7 +13,7 @@ FILE: arrayFirstOrNull.kt Null(null) } else -> { - this@R|/firstOrNullX|.R|FakeOverride|(Int(0)) + this@R|/firstOrNullX|.R|FakeOverride|(Int(0)) } } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassSubstitutionScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassSubstitutionScope.kt index 391902911dd..8f98e500f59 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassSubstitutionScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassSubstitutionScope.kt @@ -13,7 +13,6 @@ import org.jetbrains.kotlin.fir.declarations.impl.FirResolvedDeclarationStatusIm import org.jetbrains.kotlin.fir.declarations.synthetic.FirSyntheticProperty import org.jetbrains.kotlin.fir.declarations.synthetic.buildSyntheticProperty import org.jetbrains.kotlin.fir.resolve.ScopeSession -import org.jetbrains.kotlin.fir.resolve.inference.inferenceComponents import org.jetbrains.kotlin.fir.resolve.substitution.ChainedSubstitutor import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor import org.jetbrains.kotlin.fir.resolve.substitution.chain @@ -29,7 +28,6 @@ import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef import org.jetbrains.kotlin.fir.types.impl.ConeTypeParameterTypeImpl import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.types.TypeApproximatorConfiguration class FirClassSubstitutionScope( private val session: FirSession, @@ -130,18 +128,6 @@ class FirClassSubstitutionScope( return substitutor.substituteOrNull(this) } - private fun ConeKotlinType.approximateCapturedCovariant(): ConeKotlinType { - return session.inferenceComponents.approximator.approximateToSuperType( - this, TypeApproximatorConfiguration.FinalApproximationAfterResolutionAndInference - ) as? ConeKotlinType ?: this - } - - private fun ConeKotlinType.approximateCapturedContravariant(): ConeKotlinType { - return session.inferenceComponents.approximator.approximateToSubType( - this, TypeApproximatorConfiguration.FinalApproximationAfterResolutionAndInference - ) as? ConeKotlinType ?: this - } - private fun createFakeOverrideFunction(original: FirFunctionSymbol<*>): FirFunctionSymbol<*> { if (substitutor == ConeSubstitutor.Empty) return original val member = when (original) { @@ -153,7 +139,7 @@ class FirClassSubstitutionScope( val (newTypeParameters, newReceiverType, newReturnType, newSubstitutor) = createSubstitutedData(member) val newParameterTypes = member.valueParameters.map { - it.returnTypeRef.coneType.substitute(newSubstitutor)?.approximateCapturedContravariant() + it.returnTypeRef.coneType.substitute(newSubstitutor) } if (newReceiverType == null && newReturnType == null && newParameterTypes.all { it == null } && @@ -185,7 +171,7 @@ class FirClassSubstitutionScope( val (newTypeParameters, _, newReturnType, newSubstitutor) = createSubstitutedData(constructor) val newParameterTypes = constructor.valueParameters.map { - it.returnTypeRef.coneType.substitute(newSubstitutor)?.approximateCapturedContravariant() + it.returnTypeRef.coneType.substitute(newSubstitutor) } if (newReturnType == null && newParameterTypes.all { it == null } && newTypeParameters === constructor.typeParameters) { @@ -237,10 +223,10 @@ class FirClassSubstitutionScope( ) val receiverType = member.receiverTypeRef?.coneType - val newReceiverType = receiverType?.substitute(substitutor)?.approximateCapturedContravariant() + val newReceiverType = receiverType?.substitute(substitutor) val returnType = typeCalculator.tryCalculateReturnType(member).type - val newReturnType = returnType.substitute(substitutor)?.approximateCapturedCovariant() + val newReturnType = returnType.substitute(substitutor) return SubstitutedData(newTypeParameters, newReceiverType, newReturnType, substitutor) } @@ -250,7 +236,7 @@ class FirClassSubstitutionScope( if (skipPrivateMembers && member.visibility == Visibilities.Private) return original val returnType = typeCalculator.tryCalculateReturnType(member).type - val newReturnType = returnType.substitute()?.approximateCapturedCovariant() ?: return original + val newReturnType = returnType.substitute() ?: return original return createFakeOverrideField(session, member, original, newReturnType, derivedClassId) } @@ -261,10 +247,10 @@ class FirClassSubstitutionScope( if (skipPrivateMembers && member.visibility == Visibilities.Private) return original val returnType = typeCalculator.tryCalculateReturnType(member).type - val newReturnType = returnType.substitute()?.approximateCapturedCovariant() + val newReturnType = returnType.substitute() val newParameterTypes = member.getter.valueParameters.map { - it.returnTypeRef.coneType.substitute()?.approximateCapturedContravariant() + it.returnTypeRef.coneType.substitute() } if (newReturnType == null && newParameterTypes.all { it == null }) { diff --git a/compiler/testData/codegen/box/javaInterop/genericSamProjectedOut.kt b/compiler/testData/codegen/box/javaInterop/genericSamProjectedOut.kt index 8ef045a03a4..dcf71a64e16 100644 --- a/compiler/testData/codegen/box/javaInterop/genericSamProjectedOut.kt +++ b/compiler/testData/codegen/box/javaInterop/genericSamProjectedOut.kt @@ -1,5 +1,4 @@ // !LANGUAGE: -NewInference -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_RUNTIME // FILE: example/Hello.java diff --git a/compiler/testData/codegen/box/javaInterop/genericSamProjectedOutWithNewInference.kt b/compiler/testData/codegen/box/javaInterop/genericSamProjectedOutWithNewInference.kt index d254378abbb..5584c00ffc0 100644 --- a/compiler/testData/codegen/box/javaInterop/genericSamProjectedOutWithNewInference.kt +++ b/compiler/testData/codegen/box/javaInterop/genericSamProjectedOutWithNewInference.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // FILE: example/Hello.java diff --git a/compiler/testData/codegen/box/javaInterop/genericSamSmartcast.kt b/compiler/testData/codegen/box/javaInterop/genericSamSmartcast.kt index 898ed0edbf2..57842085d2a 100644 --- a/compiler/testData/codegen/box/javaInterop/genericSamSmartcast.kt +++ b/compiler/testData/codegen/box/javaInterop/genericSamSmartcast.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // FILE: A.java public class A { diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.fir.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.fir.kt index 9240e501a88..e49e9eba107 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.fir.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.fir.kt @@ -1,7 +1,7 @@ // JAVAC_EXPECTED_FILE // FILE: KotlinFile.kt fun foo(javaClass: JavaClass): String { - return javaClass.doSomething("", 1) { s: String -> "" } + return javaClass.doSomething("", 1) { s: String -> "" } } // FILE: JavaClass.java diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.fir.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.fir.kt index d049ef22f15..036f6bcf97f 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.fir.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.fir.kt @@ -2,7 +2,7 @@ // FILE: KotlinFile.kt fun foo(javaClass: JavaClass) { val a: String = javaClass.doSomething1("", 1) { p: String -> p } - val b: String = javaClass.doSomething2("", 1, true) { p: Int -> p } + val b: String = javaClass.doSomething2("", 1, true) { p: Int -> p } } // FILE: JavaClass.java diff --git a/compiler/testData/ir/irText/expressions/sam/genericSamProjectedOut.fir.txt b/compiler/testData/ir/irText/expressions/sam/genericSamProjectedOut.fir.txt index 61ac3a3fdbb..b5176c83c8f 100644 --- a/compiler/testData/ir/irText/expressions/sam/genericSamProjectedOut.fir.txt +++ b/compiler/testData/ir/irText/expressions/sam/genericSamProjectedOut.fir.txt @@ -2,21 +2,30 @@ FILE fqName: fileName:/genericSamProjectedOut.kt FUN name:test visibility:public modality:FINAL <> (a:example.SomeJavaClass) returnType:kotlin.Unit VALUE_PARAMETER name:a index:0 type:example.SomeJavaClass BLOCK_BODY - ERROR_CALL 'Unresolved reference: #' type=kotlin.Unit - FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit - ERROR_CALL 'Unresolved reference: #' type=kotlin.Unit - FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit - ERROR_CALL 'Unresolved reference: #' type=kotlin.Unit - FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' - GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + CALL 'public open fun someFunction (hello: example.Hello?): kotlin.Unit declared in example.SomeJavaClass' type=kotlin.Unit origin=null + $this: GET_VAR 'a: example.SomeJavaClass declared in .test' type=example.SomeJavaClass origin=null + hello: TYPE_OP type=example.Hello? origin=SAM_CONVERSION typeOperand=example.Hello? + FUN_EXPR type=kotlin.Function1 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:kotlin.String?) returnType:kotlin.Unit + VALUE_PARAMETER name:it index:0 type:kotlin.String? + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (it: kotlin.String?): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + CALL 'public open fun plus (hello: example.Hello?): kotlin.Unit [operator] declared in example.SomeJavaClass' type=kotlin.Unit origin=PLUS + $this: GET_VAR 'a: example.SomeJavaClass declared in .test' type=example.SomeJavaClass origin=null + hello: TYPE_OP type=example.Hello? origin=SAM_CONVERSION typeOperand=example.Hello? + FUN_EXPR type=kotlin.Function1 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:kotlin.String?) returnType:kotlin.Unit + VALUE_PARAMETER name:it index:0 type:kotlin.String? + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (it: kotlin.String?): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + CALL 'public open fun get (hello: example.Hello?): kotlin.Unit [operator] declared in example.SomeJavaClass' type=kotlin.Unit origin=null + $this: GET_VAR 'a: example.SomeJavaClass declared in .test' type=example.SomeJavaClass origin=null + hello: TYPE_OP type=example.Hello? origin=SAM_CONVERSION typeOperand=example.Hello? + FUN_EXPR type=kotlin.Function1 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:kotlin.String?) returnType:kotlin.Unit + VALUE_PARAMETER name:it index:0 type:kotlin.String? + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (it: kotlin.String?): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit diff --git a/compiler/testData/ir/irText/expressions/sam/genericSamSmartcast.fir.txt b/compiler/testData/ir/irText/expressions/sam/genericSamSmartcast.fir.txt index e4b275f6734..d25cef9cccb 100644 --- a/compiler/testData/ir/irText/expressions/sam/genericSamSmartcast.fir.txt +++ b/compiler/testData/ir/irText/expressions/sam/genericSamSmartcast.fir.txt @@ -7,12 +7,15 @@ FILE fqName: fileName:/genericSamSmartcast.kt if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=.A<*> GET_VAR 'x: kotlin.Any declared in .f' type=kotlin.Any origin=null then: RETURN type=kotlin.Nothing from='public final fun f (x: kotlin.Any): kotlin.String declared in ' - ERROR_CALL 'Unresolved reference: #' type=kotlin.String? - FUN_EXPR type=kotlin.Function1 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (y:kotlin.Any?) returnType:kotlin.String - VALUE_PARAMETER name:y index:0 type:kotlin.Any? - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (y: kotlin.Any?): kotlin.String declared in .f' - CONST String type=kotlin.String value="OK" + CALL 'public open fun call (block: .A.I.A?>?): kotlin.String? declared in .A' type=kotlin.String? origin=null + $this: TYPE_OP type=.A<*> origin=IMPLICIT_CAST typeOperand=.A<*> + GET_VAR 'x: kotlin.Any declared in .f' type=kotlin.Any origin=null + block: TYPE_OP type=.A.I? origin=SAM_CONVERSION typeOperand=.A.I? + FUN_EXPR type=kotlin.Function1 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (y:kotlin.Any?) returnType:kotlin.String? + VALUE_PARAMETER name:y index:0 type:kotlin.Any? + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (y: kotlin.Any?): kotlin.String? declared in .f' + CONST String type=kotlin.String value="OK" RETURN type=kotlin.Nothing from='public final fun f (x: kotlin.Any): kotlin.String declared in ' CONST String type=kotlin.String value="Fail"