From 4ecb228d50752554ed5343c2b7a01b63a1bbe3e4 Mon Sep 17 00:00:00 2001 From: Georgy Bronnikov Date: Tue, 16 Jun 2020 13:43:32 +0300 Subject: [PATCH] IR: handle enhanced nullability in TypeTranslator --- .../kotlin/fir/backend/Fir2IrConverter.kt | 7 +- .../psi2ir/generators/GeneratorContext.kt | 4 +- .../psi2ir/generators/GeneratorExtensions.kt | 11 -- .../kotlin/ir/types/IrTypeSystemContext.kt | 4 +- .../ir/util/DeclarationStubGenerator.kt | 11 +- .../kotlin/ir/util/StubGeneratorExtensions.kt | 12 ++ .../kotlin/ir/util/TypeTranslator.kt | 5 +- ...plicitNotNullOnDelegatedImplementation.txt | 12 +- .../nullCheckOnGenericLambdaReturn.txt | 24 ++-- .../expressions/nullCheckOnLambdaReturn.txt | 2 +- .../typeParametersInImplicitCast.txt | 8 +- .../testData/ir/irText/stubs/builtinMap.txt | 2 +- .../types/nullChecks/enhancedNullability.txt | 22 ++-- ...edNullabilityInDestructuringAssignment.txt | 96 +++++++-------- .../enhancedNullabilityInForLoop.txt | 114 +++++++++--------- 15 files changed, 174 insertions(+), 160 deletions(-) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrConverter.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrConverter.kt index f9c47aadb69..992e3be81ed 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrConverter.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrConverter.kt @@ -174,7 +174,12 @@ class Fir2IrConverter( val moduleDescriptor = FirModuleDescriptor(session) val symbolTable = SymbolTable(signaturer) val constantValueGenerator = ConstantValueGenerator(moduleDescriptor, symbolTable) - val typeTranslator = TypeTranslator(symbolTable, languageVersionSettings, moduleDescriptor.builtIns) + val typeTranslator = TypeTranslator( + symbolTable, + languageVersionSettings, + moduleDescriptor.builtIns, + extensions = generatorExtensions + ) constantValueGenerator.typeTranslator = typeTranslator typeTranslator.constantValueGenerator = constantValueGenerator val builtIns = IrBuiltIns(moduleDescriptor.builtIns, typeTranslator, symbolTable) diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/GeneratorContext.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/GeneratorContext.kt index 2efab727dd5..a4e7557f076 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/GeneratorContext.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/GeneratorContext.kt @@ -30,7 +30,9 @@ fun createGeneratorContext( symbolTable: SymbolTable, extensions: GeneratorExtensions ): GeneratorContext { - val typeTranslator = TypeTranslator(symbolTable, languageVersionSettings, builtIns = moduleDescriptor.builtIns) + val typeTranslator = TypeTranslator( + symbolTable, languageVersionSettings, builtIns = moduleDescriptor.builtIns, extensions = extensions + ) val constantValueGenerator = ConstantValueGenerator(moduleDescriptor, symbolTable) typeTranslator.constantValueGenerator = constantValueGenerator constantValueGenerator.typeTranslator = typeTranslator diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/GeneratorExtensions.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/GeneratorExtensions.kt index 4655ab41901..741cb487e11 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/GeneratorExtensions.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/GeneratorExtensions.kt @@ -28,16 +28,5 @@ open class GeneratorExtensions : StubGeneratorExtensions() { open fun computeFieldVisibility(descriptor: PropertyDescriptor): Visibility? = null - open val enhancedNullability: EnhancedNullability - get() = EnhancedNullability - - open class EnhancedNullability { - open fun hasEnhancedNullability(kotlinType: KotlinType): Boolean = false - - open fun stripEnhancedNullability(kotlinType: KotlinType): KotlinType = kotlinType - - companion object Instance : EnhancedNullability() - } - open fun getParentClassStaticScope(descriptor: ClassDescriptor): MemberScope? = null } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/IrTypeSystemContext.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/IrTypeSystemContext.kt index 644a4ac6687..174fff3a5d4 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/IrTypeSystemContext.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/IrTypeSystemContext.kt @@ -305,9 +305,7 @@ interface IrTypeSystemContext : TypeSystemContext, TypeSystemCommonSuperTypesCon } override fun KotlinTypeMarker.hasAnnotation(fqName: FqName): Boolean = - // TODO: don't fall back to KotlinType to check annotations. Currently testIdentityEquals fails on JVM without it - (this as IrAnnotationContainer).hasAnnotation(fqName) || - (this as IrType).toKotlinType().annotations.hasAnnotation(fqName) + (this as IrAnnotationContainer).hasAnnotation(fqName) override fun KotlinTypeMarker.getAnnotationFirstArgumentValue(fqName: FqName): Any? = (this as? IrType)?.annotations?.firstOrNull { annotation -> diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeclarationStubGenerator.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeclarationStubGenerator.kt index 6b76e0af352..3fd8851bd06 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeclarationStubGenerator.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeclarationStubGenerator.kt @@ -44,7 +44,7 @@ class DeclarationStubGenerator( val moduleDescriptor: ModuleDescriptor, val symbolTable: SymbolTable, languageVersionSettings: LanguageVersionSettings, - val extensions: StubGeneratorExtensions = StubGeneratorExtensions.EMPTY + val extensions: StubGeneratorExtensions = StubGeneratorExtensions.EMPTY, ) : IrProvider { private val lazyTable = symbolTable.lazyWrapper @@ -61,7 +61,14 @@ class DeclarationStubGenerator( } val typeTranslator = - TypeTranslator(lazyTable, languageVersionSettings, moduleDescriptor.builtIns, LazyScopedTypeParametersResolver(lazyTable), true) + TypeTranslator( + lazyTable, + languageVersionSettings, + moduleDescriptor.builtIns, + LazyScopedTypeParametersResolver(lazyTable), + true, + extensions + ) private val constantValueGenerator = ConstantValueGenerator(moduleDescriptor, lazyTable) private val facadeClassMap = mutableMapOf() diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/StubGeneratorExtensions.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/StubGeneratorExtensions.kt index 753d498968d..42f53aef67b 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/StubGeneratorExtensions.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/StubGeneratorExtensions.kt @@ -10,6 +10,7 @@ import org.jetbrains.kotlin.descriptors.PropertyDescriptor import org.jetbrains.kotlin.ir.declarations.IrClass import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource +import org.jetbrains.kotlin.types.KotlinType open class StubGeneratorExtensions { open fun computeExternalDeclarationOrigin(descriptor: DeclarationDescriptor): IrDeclarationOrigin? = null @@ -18,6 +19,17 @@ open class StubGeneratorExtensions { open fun isPropertyWithPlatformField(descriptor: PropertyDescriptor): Boolean = false + open val enhancedNullability: EnhancedNullability + get() = EnhancedNullability + + open class EnhancedNullability { + open fun hasEnhancedNullability(kotlinType: KotlinType): Boolean = false + + open fun stripEnhancedNullability(kotlinType: KotlinType): KotlinType = kotlinType + + companion object Instance : EnhancedNullability() + } + companion object { @JvmField val EMPTY = StubGeneratorExtensions() diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/TypeTranslator.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/TypeTranslator.kt index 7e2053c04e1..77d053ba6c9 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/TypeTranslator.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/TypeTranslator.kt @@ -32,7 +32,8 @@ class TypeTranslator( val languageVersionSettings: LanguageVersionSettings, builtIns: KotlinBuiltIns, private val typeParametersResolver: TypeParametersResolver = ScopedTypeParametersResolver(), - private val enterTableScope: Boolean = false + private val enterTableScope: Boolean = false, + private val extensions: StubGeneratorExtensions = StubGeneratorExtensions.EMPTY ) { private val erasureStack = Stack() @@ -108,7 +109,7 @@ class TypeTranslator( return IrSimpleTypeBuilder().apply { this.kotlinType = flexibleApproximatedType - this.hasQuestionMark = approximatedType.isMarkedNullable + this.hasQuestionMark = approximatedType.isMarkedNullable || extensions.enhancedNullability.hasEnhancedNullability(approximatedType) this.variance = variance this.abbreviation = approximatedType.getAbbreviation()?.toIrTypeAbbreviation() when (ktTypeDescriptor) { diff --git a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.txt b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.txt index 8388f7164ec..db4f83f3130 100644 --- a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.txt +++ b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.txt @@ -27,9 +27,9 @@ FILE fqName: fileName:/implicitNotNullOnDelegatedImplementation.kt public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .JFoo $this: VALUE_PARAMETER name: type:kotlin.Any VALUE_PARAMETER name:other index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:foo visibility:public modality:OPEN <> ($this:.JFoo) returnType:kotlin.String [fake_override] + FUN FAKE_OVERRIDE name:foo visibility:public modality:OPEN <> ($this:.JFoo) returnType:kotlin.String? [fake_override] overridden: - public open fun foo (): kotlin.String declared in .JFoo + public open fun foo (): kotlin.String? declared in .JFoo $this: VALUE_PARAMETER name: type:.JFoo FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] overridden: @@ -47,12 +47,12 @@ FILE fqName: fileName:/implicitNotNullOnDelegatedImplementation.kt INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:K2 modality:FINAL visibility:public superTypes:[.JFoo]' FUN name:foo visibility:public modality:OPEN <> ($this:.K2) returnType:kotlin.String overridden: - public open fun foo (): kotlin.String declared in .JFoo + public open fun foo (): kotlin.String? declared in .JFoo $this: VALUE_PARAMETER name: type:.K2 BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun foo (): kotlin.String declared in .K2' TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String - CALL 'public open fun foo (): kotlin.String declared in .JFoo' superQualifier='CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB CLASS name:JFoo modality:OPEN visibility:public superTypes:[.IFoo]' type=kotlin.String origin=null + CALL 'public open fun foo (): kotlin.String? declared in .JFoo' superQualifier='CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB CLASS name:JFoo modality:OPEN visibility:public superTypes:[.IFoo]' type=kotlin.String? origin=null $this: GET_VAR ': .K2 declared in .K2.foo' type=.K2 origin=null FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: @@ -141,7 +141,7 @@ FILE fqName: fileName:/implicitNotNullOnDelegatedImplementation.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun foo (): kotlin.String declared in .TestJFoo' TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String - CALL 'public open fun foo (): kotlin.String declared in .JFoo' type=kotlin.String origin=null + CALL 'public open fun foo (): kotlin.String? declared in .JFoo' type=kotlin.String? origin=null $this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:.JFoo visibility:private [final]' type=.JFoo origin=null receiver: GET_VAR ': .TestJFoo declared in .TestJFoo.foo' type=.TestJFoo origin=null FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] @@ -173,7 +173,7 @@ FILE fqName: fileName:/implicitNotNullOnDelegatedImplementation.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun foo (): kotlin.String declared in .TestK1' TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String - CALL 'public open fun foo (): kotlin.String [fake_override] declared in .K1' type=kotlin.String origin=null + CALL 'public open fun foo (): kotlin.String? [fake_override] declared in .K1' type=kotlin.String? origin=null $this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:.K1 visibility:private [final]' type=.K1 origin=null receiver: GET_VAR ': .TestK1 declared in .TestK1.foo' type=.TestK1 origin=null FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] diff --git a/compiler/testData/ir/irText/expressions/nullCheckOnGenericLambdaReturn.txt b/compiler/testData/ir/irText/expressions/nullCheckOnGenericLambdaReturn.txt index 423dc3101e1..78110020039 100644 --- a/compiler/testData/ir/irText/expressions/nullCheckOnGenericLambdaReturn.txt +++ b/compiler/testData/ir/irText/expressions/nullCheckOnGenericLambdaReturn.txt @@ -45,13 +45,13 @@ FILE fqName: fileName:/nullCheckOnGenericLambdaReturn.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun test2 (): kotlin.String declared in ' TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String - CALL 'public final fun checkT (fn: kotlin.Function0.checkT>): T of .checkT declared in ' type=kotlin.String origin=null - : kotlin.String - fn: FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String + CALL 'public final fun checkT (fn: kotlin.Function0.checkT>): T of .checkT declared in ' type=kotlin.String? origin=null + : kotlin.String? + fn: FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String? BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .test2' - CALL 'public open fun nnFoo (): kotlin.String declared in .J' type=kotlin.String origin=null + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String? declared in .test2' + CALL 'public open fun nnFoo (): kotlin.String? declared in .J' type=kotlin.String? origin=null FUN name:test3 visibility:public modality:FINAL <> () returnType:kotlin.String? BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun test3 (): kotlin.String? declared in ' @@ -66,10 +66,10 @@ FILE fqName: fileName:/nullCheckOnGenericLambdaReturn.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun test4 (): kotlin.String declared in ' TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String - CALL 'public final fun checkTAny (fn: kotlin.Function0.checkTAny>): T of .checkTAny declared in ' type=kotlin.String origin=null - : kotlin.String - fn: FUN_EXPR type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String + CALL 'public final fun checkTAny (fn: kotlin.Function0.checkTAny>): T of .checkTAny declared in ' type=kotlin.String? origin=null + : kotlin.String? + fn: FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String? BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .test4' - CALL 'public open fun nnFoo (): kotlin.String declared in .J' type=kotlin.String origin=null + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String? declared in .test4' + CALL 'public open fun nnFoo (): kotlin.String? declared in .J' type=kotlin.String? origin=null diff --git a/compiler/testData/ir/irText/expressions/nullCheckOnLambdaReturn.txt b/compiler/testData/ir/irText/expressions/nullCheckOnLambdaReturn.txt index a5663086194..d86c495ca2f 100644 --- a/compiler/testData/ir/irText/expressions/nullCheckOnLambdaReturn.txt +++ b/compiler/testData/ir/irText/expressions/nullCheckOnLambdaReturn.txt @@ -87,4 +87,4 @@ FILE fqName: fileName:/nullCheckOnLambdaReturn.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Any? BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.Any? declared in .test6' - CALL 'public open fun nnFoo (): kotlin.String declared in .J' type=kotlin.String origin=null + CALL 'public open fun nnFoo (): kotlin.String? declared in .J' type=kotlin.String? origin=null diff --git a/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.txt b/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.txt index 1fc9ec34a5b..3440c4866a3 100644 --- a/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.txt +++ b/compiler/testData/ir/irText/regressions/typeParametersInImplicitCast.txt @@ -8,12 +8,12 @@ FILE fqName: fileName:/typeParametersInImplicitCast.kt : kotlin.collections.List.problematic> : T of .problematic? $receiver: GET_VAR 'lss: kotlin.collections.List.problematic>> declared in .problematic' type=kotlin.collections.List.problematic>> origin=null - transform: FUN_EXPR type=kotlin.Function1.problematic>, kotlin.collections.Iterable.problematic?>> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:kotlin.collections.List.problematic>) returnType:kotlin.collections.Iterable.problematic?> + transform: FUN_EXPR type=kotlin.Function1.problematic>, kotlin.collections.List.problematic?>?> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:kotlin.collections.List.problematic>) returnType:kotlin.collections.List.problematic?>? VALUE_PARAMETER name:it index:0 type:kotlin.collections.List.problematic> BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (it: kotlin.collections.List.problematic>): kotlin.collections.Iterable.problematic?> declared in .problematic' + RETURN type=kotlin.Nothing from='local final fun (it: kotlin.collections.List.problematic>): kotlin.collections.List.problematic?>? declared in .problematic' TYPE_OP type=kotlin.collections.List.problematic?> origin=IMPLICIT_NOTNULL typeOperand=kotlin.collections.List.problematic?> - CALL 'public/*package*/ open fun id (v: kotlin.collections.List.ListId.id?>?): kotlin.collections.List.ListId.id?> declared in .ListId' type=kotlin.collections.List.problematic?> origin=null + CALL 'public/*package*/ open fun id (v: kotlin.collections.List.ListId.id?>?): kotlin.collections.List.ListId.id?>? declared in .ListId' type=kotlin.collections.List.problematic?>? origin=null : T of .problematic? v: GET_VAR 'it: kotlin.collections.List.problematic> declared in .problematic.' type=kotlin.collections.List.problematic> origin=null diff --git a/compiler/testData/ir/irText/stubs/builtinMap.txt b/compiler/testData/ir/irText/stubs/builtinMap.txt index b2d17198d93..009afa05a51 100644 --- a/compiler/testData/ir/irText/stubs/builtinMap.txt +++ b/compiler/testData/ir/irText/stubs/builtinMap.txt @@ -27,7 +27,7 @@ FILE fqName: fileName:/builtinMap.kt $receiver: VALUE_PARAMETER name: type:java.util.LinkedHashMap.plus?, V1 of .plus?>{ kotlin.collections.LinkedHashMap.plus?, V1 of .plus?> } BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit - CALL 'public open fun put (key: K of java.util.LinkedHashMap, value: V of java.util.LinkedHashMap): V of java.util.LinkedHashMap? [fake_override] declared in java.util.LinkedHashMap' type=V1 of .plus? origin=null + CALL 'public open fun put (key: K of java.util.LinkedHashMap?, value: V of java.util.LinkedHashMap?): V of java.util.LinkedHashMap? [fake_override] declared in java.util.LinkedHashMap' type=V1 of .plus? origin=null $this: GET_VAR ': java.util.LinkedHashMap.plus?, V1 of .plus?>{ kotlin.collections.LinkedHashMap.plus?, V1 of .plus?> } declared in .plus.' type=java.util.LinkedHashMap.plus?, V1 of .plus?>{ kotlin.collections.LinkedHashMap.plus?, V1 of .plus?> } origin=null key: CALL 'public final fun (): A of kotlin.Pair declared in kotlin.Pair' type=K1 of .plus origin=GET_PROPERTY $this: GET_VAR 'pair: kotlin.Pair.plus, V1 of .plus> declared in .plus' type=kotlin.Pair.plus, V1 of .plus> origin=null diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullability.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullability.txt index 4349ca7d457..534d10006d3 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullability.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullability.txt @@ -6,22 +6,22 @@ FILE fqName: fileName:/enhancedNullability.kt BLOCK_BODY CALL 'public final fun use (s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null s: TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String - CALL 'public open fun notNullString (): kotlin.String declared in .J' type=kotlin.String origin=null + CALL 'public open fun notNullString (): kotlin.String? declared in .J' type=kotlin.String? origin=null FUN name:testLocalVal visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY VAR name:local type:kotlin.String [val] TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String - CALL 'public open fun notNullString (): kotlin.String declared in .J' type=kotlin.String origin=null + CALL 'public open fun notNullString (): kotlin.String? declared in .J' type=kotlin.String? origin=null FUN name:testReturnValue visibility:public modality:FINAL <> () returnType:kotlin.String BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun testReturnValue (): kotlin.String declared in ' TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String - CALL 'public open fun notNullString (): kotlin.String declared in .J' type=kotlin.String origin=null + CALL 'public open fun notNullString (): kotlin.String? declared in .J' type=kotlin.String? origin=null PROPERTY name:testGlobalVal visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:testGlobalVal type:kotlin.String visibility:private [final,static] EXPRESSION_BODY TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String - CALL 'public open fun notNullString (): kotlin.String declared in .J' type=kotlin.String origin=null + CALL 'public open fun notNullString (): kotlin.String? declared in .J' type=kotlin.String? origin=null FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.String correspondingProperty: PROPERTY name:testGlobalVal visibility:public modality:FINAL [val] BLOCK_BODY @@ -33,21 +33,21 @@ FILE fqName: fileName:/enhancedNullability.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in ' TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String - CALL 'public open fun notNullString (): kotlin.String declared in .J' type=kotlin.String origin=null + CALL 'public open fun notNullString (): kotlin.String? declared in .J' type=kotlin.String? origin=null FUN name:testJUse visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY - CALL 'public open fun use (s: kotlin.String): kotlin.Unit declared in .J' type=kotlin.Unit origin=null + CALL 'public open fun use (s: kotlin.String?): kotlin.Unit declared in .J' type=kotlin.Unit origin=null s: CALL 'public open fun nullString (): kotlin.String? declared in .J' type=kotlin.String? origin=null - CALL 'public open fun use (s: kotlin.String): kotlin.Unit declared in .J' type=kotlin.Unit origin=null - s: CALL 'public open fun notNullString (): kotlin.String declared in .J' type=kotlin.String origin=null + CALL 'public open fun use (s: kotlin.String?): kotlin.Unit declared in .J' type=kotlin.Unit origin=null + s: CALL 'public open fun notNullString (): kotlin.String? declared in .J' type=kotlin.String? origin=null FUN name:testLocalVarUse visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY VAR name:ns type:kotlin.String? [val] CALL 'public open fun nullString (): kotlin.String? declared in .J' type=kotlin.String? origin=null - CALL 'public open fun use (s: kotlin.String): kotlin.Unit declared in .J' type=kotlin.Unit origin=null + CALL 'public open fun use (s: kotlin.String?): kotlin.Unit declared in .J' type=kotlin.Unit origin=null s: GET_VAR 'val ns: kotlin.String? [val] declared in .testLocalVarUse' type=kotlin.String? origin=null VAR name:nns type:kotlin.String [val] TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String - CALL 'public open fun notNullString (): kotlin.String declared in .J' type=kotlin.String origin=null - CALL 'public open fun use (s: kotlin.String): kotlin.Unit declared in .J' type=kotlin.Unit origin=null + CALL 'public open fun notNullString (): kotlin.String? declared in .J' type=kotlin.String? origin=null + CALL 'public open fun use (s: kotlin.String?): kotlin.Unit declared in .J' type=kotlin.Unit origin=null s: GET_VAR 'val nns: kotlin.String [val] declared in .testLocalVarUse' type=kotlin.String origin=null diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.txt index 2c86ba652f4..983024480cb 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.txt @@ -118,89 +118,89 @@ FILE fqName: fileName:/enhancedNullabilityInDestructuringAssignment.kt FUN name:test1 visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY COMPOSITE type=kotlin.Unit origin=DESTRUCTURING_DECLARATION - VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.P [val] - CALL 'public open fun notNullP (): .P declared in .J' type=.P origin=null + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.P? [val] + CALL 'public open fun notNullP (): .P? declared in .J' type=.P? origin=null VAR name:x type:kotlin.Int [val] CALL 'public final fun component1 (): kotlin.Int [operator] declared in .P' type=kotlin.Int origin=COMPONENT_N(index=1) $this: TYPE_OP type=.P origin=IMPLICIT_NOTNULL typeOperand=.P - GET_VAR 'val tmp_0: .P [val] declared in .test1' type=.P origin=null + GET_VAR 'val tmp_0: .P? [val] declared in .test1' type=.P? origin=null VAR name:y type:kotlin.Int [val] CALL 'public final fun component2 (): kotlin.Int [operator] declared in .P' type=kotlin.Int origin=COMPONENT_N(index=2) $this: TYPE_OP type=.P origin=IMPLICIT_NOTNULL typeOperand=.P - GET_VAR 'val tmp_0: .P [val] declared in .test1' type=.P origin=null + GET_VAR 'val tmp_0: .P? [val] declared in .test1' type=.P? origin=null CALL 'public final fun use (x: kotlin.Any, y: kotlin.Any): kotlin.Unit declared in ' type=kotlin.Unit origin=null x: GET_VAR 'val x: kotlin.Int [val] declared in .test1' type=kotlin.Int origin=null y: GET_VAR 'val y: kotlin.Int [val] declared in .test1' type=kotlin.Int origin=null FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY COMPOSITE type=kotlin.Unit origin=DESTRUCTURING_DECLARATION - VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:.Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String>? [val] - CALL 'public open fun notNullComponents (): .Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String>? declared in .J' type=.Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String>? origin=null - VAR name:x type:@[NotNull(value = )] kotlin.String [val] - CALL 'public final fun component1 (): T1 of .Q [operator] declared in .Q' type=@[NotNull(value = )] kotlin.String origin=COMPONENT_N(index=1) - $this: TYPE_OP type=.Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String> origin=IMPLICIT_NOTNULL typeOperand=.Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String> - GET_VAR 'val tmp_1: .Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String>? [val] declared in .test2' type=.Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String>? origin=null - VAR name:y type:@[NotNull(value = )] kotlin.String [val] - CALL 'public final fun component2 (): T2 of .Q [operator] declared in .Q' type=@[NotNull(value = )] kotlin.String origin=COMPONENT_N(index=2) - $this: TYPE_OP type=.Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String> origin=IMPLICIT_NOTNULL typeOperand=.Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String> - GET_VAR 'val tmp_1: .Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String>? [val] declared in .test2' type=.Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String>? origin=null + VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:.Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?>? [val] + CALL 'public open fun notNullComponents (): .Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?>? declared in .J' type=.Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?>? origin=null + VAR name:x type:@[NotNull(value = )] kotlin.String? [val] + CALL 'public final fun component1 (): T1 of .Q [operator] declared in .Q' type=@[NotNull(value = )] kotlin.String? origin=COMPONENT_N(index=1) + $this: TYPE_OP type=.Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?> origin=IMPLICIT_NOTNULL typeOperand=.Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?> + GET_VAR 'val tmp_1: .Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?>? [val] declared in .test2' type=.Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?>? origin=null + VAR name:y type:@[NotNull(value = )] kotlin.String? [val] + CALL 'public final fun component2 (): T2 of .Q [operator] declared in .Q' type=@[NotNull(value = )] kotlin.String? origin=COMPONENT_N(index=2) + $this: TYPE_OP type=.Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?> origin=IMPLICIT_NOTNULL typeOperand=.Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?> + GET_VAR 'val tmp_1: .Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?>? [val] declared in .test2' type=.Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?>? origin=null CALL 'public final fun use (x: kotlin.Any, y: kotlin.Any): kotlin.Unit declared in ' type=kotlin.Unit origin=null x: TYPE_OP type=@[NotNull(value = )] kotlin.String origin=IMPLICIT_NOTNULL typeOperand=@[NotNull(value = )] kotlin.String - GET_VAR 'val x: @[NotNull(value = )] kotlin.String [val] declared in .test2' type=@[NotNull(value = )] kotlin.String origin=null + GET_VAR 'val x: @[NotNull(value = )] kotlin.String? [val] declared in .test2' type=@[NotNull(value = )] kotlin.String? origin=null y: TYPE_OP type=@[NotNull(value = )] kotlin.String origin=IMPLICIT_NOTNULL typeOperand=@[NotNull(value = )] kotlin.String - GET_VAR 'val y: @[NotNull(value = )] kotlin.String [val] declared in .test2' type=@[NotNull(value = )] kotlin.String origin=null + GET_VAR 'val y: @[NotNull(value = )] kotlin.String? [val] declared in .test2' type=@[NotNull(value = )] kotlin.String? origin=null FUN name:test2Desugared visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY - VAR name:tmp type:.Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String>? [val] - CALL 'public open fun notNullComponents (): .Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String>? declared in .J' type=.Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String>? origin=null + VAR name:tmp type:.Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?>? [val] + CALL 'public open fun notNullComponents (): .Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?>? declared in .J' type=.Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?>? origin=null VAR name:x type:@[NotNull(value = )] kotlin.String [val] TYPE_OP type=@[NotNull(value = )] kotlin.String origin=IMPLICIT_NOTNULL typeOperand=@[NotNull(value = )] kotlin.String - CALL 'public final fun component1 (): T1 of .Q [operator] declared in .Q' type=@[NotNull(value = )] kotlin.String origin=null - $this: TYPE_OP type=.Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String> origin=IMPLICIT_NOTNULL typeOperand=.Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String> - GET_VAR 'val tmp: .Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String>? [val] declared in .test2Desugared' type=.Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String>? origin=null + CALL 'public final fun component1 (): T1 of .Q [operator] declared in .Q' type=@[NotNull(value = )] kotlin.String? origin=null + $this: TYPE_OP type=.Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?> origin=IMPLICIT_NOTNULL typeOperand=.Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?> + GET_VAR 'val tmp: .Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?>? [val] declared in .test2Desugared' type=.Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?>? origin=null VAR name:y type:@[NotNull(value = )] kotlin.String [val] TYPE_OP type=@[NotNull(value = )] kotlin.String origin=IMPLICIT_NOTNULL typeOperand=@[NotNull(value = )] kotlin.String - CALL 'public final fun component2 (): T2 of .Q [operator] declared in .Q' type=@[NotNull(value = )] kotlin.String origin=null - $this: TYPE_OP type=.Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String> origin=IMPLICIT_NOTNULL typeOperand=.Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String> - GET_VAR 'val tmp: .Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String>? [val] declared in .test2Desugared' type=.Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String>? origin=null + CALL 'public final fun component2 (): T2 of .Q [operator] declared in .Q' type=@[NotNull(value = )] kotlin.String? origin=null + $this: TYPE_OP type=.Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?> origin=IMPLICIT_NOTNULL typeOperand=.Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?> + GET_VAR 'val tmp: .Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?>? [val] declared in .test2Desugared' type=.Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?>? origin=null CALL 'public final fun use (x: kotlin.Any, y: kotlin.Any): kotlin.Unit declared in ' type=kotlin.Unit origin=null x: GET_VAR 'val x: @[NotNull(value = )] kotlin.String [val] declared in .test2Desugared' type=@[NotNull(value = )] kotlin.String origin=null y: GET_VAR 'val y: @[NotNull(value = )] kotlin.String [val] declared in .test2Desugared' type=@[NotNull(value = )] kotlin.String origin=null FUN name:test3 visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY COMPOSITE type=kotlin.Unit origin=DESTRUCTURING_DECLARATION - VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:.Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String> [val] - CALL 'public open fun notNullQAndComponents (): .Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String> declared in .J' type=.Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String> origin=null - VAR name:x type:@[NotNull(value = )] kotlin.String [val] - CALL 'public final fun component1 (): T1 of .Q [operator] declared in .Q' type=@[NotNull(value = )] kotlin.String origin=COMPONENT_N(index=1) - $this: TYPE_OP type=.Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String> origin=IMPLICIT_NOTNULL typeOperand=.Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String> - GET_VAR 'val tmp_2: .Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String> [val] declared in .test3' type=.Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String> origin=null - VAR name:y type:@[NotNull(value = )] kotlin.String [val] - CALL 'public final fun component2 (): T2 of .Q [operator] declared in .Q' type=@[NotNull(value = )] kotlin.String origin=COMPONENT_N(index=2) - $this: TYPE_OP type=.Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String> origin=IMPLICIT_NOTNULL typeOperand=.Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String> - GET_VAR 'val tmp_2: .Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String> [val] declared in .test3' type=.Q<@[NotNull(value = )] kotlin.String, @[NotNull(value = )] kotlin.String> origin=null + VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:.Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?>? [val] + CALL 'public open fun notNullQAndComponents (): .Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?>? declared in .J' type=.Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?>? origin=null + VAR name:x type:@[NotNull(value = )] kotlin.String? [val] + CALL 'public final fun component1 (): T1 of .Q [operator] declared in .Q' type=@[NotNull(value = )] kotlin.String? origin=COMPONENT_N(index=1) + $this: TYPE_OP type=.Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?> origin=IMPLICIT_NOTNULL typeOperand=.Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?> + GET_VAR 'val tmp_2: .Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?>? [val] declared in .test3' type=.Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?>? origin=null + VAR name:y type:@[NotNull(value = )] kotlin.String? [val] + CALL 'public final fun component2 (): T2 of .Q [operator] declared in .Q' type=@[NotNull(value = )] kotlin.String? origin=COMPONENT_N(index=2) + $this: TYPE_OP type=.Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?> origin=IMPLICIT_NOTNULL typeOperand=.Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?> + GET_VAR 'val tmp_2: .Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?>? [val] declared in .test3' type=.Q<@[NotNull(value = )] kotlin.String?, @[NotNull(value = )] kotlin.String?>? origin=null CALL 'public final fun use (x: kotlin.Any, y: kotlin.Any): kotlin.Unit declared in ' type=kotlin.Unit origin=null x: TYPE_OP type=@[NotNull(value = )] kotlin.String origin=IMPLICIT_NOTNULL typeOperand=@[NotNull(value = )] kotlin.String - GET_VAR 'val x: @[NotNull(value = )] kotlin.String [val] declared in .test3' type=@[NotNull(value = )] kotlin.String origin=null + GET_VAR 'val x: @[NotNull(value = )] kotlin.String? [val] declared in .test3' type=@[NotNull(value = )] kotlin.String? origin=null y: TYPE_OP type=@[NotNull(value = )] kotlin.String origin=IMPLICIT_NOTNULL typeOperand=@[NotNull(value = )] kotlin.String - GET_VAR 'val y: @[NotNull(value = )] kotlin.String [val] declared in .test3' type=@[NotNull(value = )] kotlin.String origin=null + GET_VAR 'val y: @[NotNull(value = )] kotlin.String? [val] declared in .test3' type=@[NotNull(value = )] kotlin.String? origin=null FUN name:test4 visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY COMPOSITE type=kotlin.Unit origin=DESTRUCTURING_DECLARATION - VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.collections.IndexedValue<@[NotNull(value = )] .P> [val] - CALL 'public final fun first (): T of kotlin.collections.first declared in kotlin.collections' type=kotlin.collections.IndexedValue<@[NotNull(value = )] .P> origin=null - : kotlin.collections.IndexedValue<@[NotNull(value = )] .P> - $receiver: CALL 'public final fun withIndex (): kotlin.collections.Iterable> declared in kotlin.collections' type=kotlin.collections.Iterable)] .P>> origin=null - : @[NotNull(value = )] .P - $receiver: TYPE_OP type=kotlin.collections.List<@[NotNull(value = )] .P> origin=IMPLICIT_NOTNULL typeOperand=kotlin.collections.List<@[NotNull(value = )] .P> - CALL 'public open fun listOfNotNull (): kotlin.collections.List<@[NotNull(value = )] .P>? declared in .J' type=kotlin.collections.List<@[NotNull(value = )] .P>? origin=null + VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.collections.IndexedValue<@[NotNull(value = )] .P?> [val] + CALL 'public final fun first (): T of kotlin.collections.first declared in kotlin.collections' type=kotlin.collections.IndexedValue<@[NotNull(value = )] .P?> origin=null + : kotlin.collections.IndexedValue<@[NotNull(value = )] .P?> + $receiver: CALL 'public final fun withIndex (): kotlin.collections.Iterable> declared in kotlin.collections' type=kotlin.collections.Iterable)] .P?>> origin=null + : @[NotNull(value = )] .P? + $receiver: TYPE_OP type=kotlin.collections.List<@[NotNull(value = )] .P?> origin=IMPLICIT_NOTNULL typeOperand=kotlin.collections.List<@[NotNull(value = )] .P?> + CALL 'public open fun listOfNotNull (): kotlin.collections.List<@[NotNull(value = )] .P?>? declared in .J' type=kotlin.collections.List<@[NotNull(value = )] .P?>? origin=null VAR name:x type:kotlin.Int [val] CALL 'public final fun component1 (): kotlin.Int [operator] declared in kotlin.collections.IndexedValue' type=kotlin.Int origin=COMPONENT_N(index=1) - $this: GET_VAR 'val tmp_3: kotlin.collections.IndexedValue<@[NotNull(value = )] .P> [val] declared in .test4' type=kotlin.collections.IndexedValue<@[NotNull(value = )] .P> origin=null - VAR name:y type:@[NotNull(value = )] .P [val] - CALL 'public final fun component2 (): T of kotlin.collections.IndexedValue [operator] declared in kotlin.collections.IndexedValue' type=@[NotNull(value = )] .P origin=COMPONENT_N(index=2) - $this: GET_VAR 'val tmp_3: kotlin.collections.IndexedValue<@[NotNull(value = )] .P> [val] declared in .test4' type=kotlin.collections.IndexedValue<@[NotNull(value = )] .P> origin=null + $this: GET_VAR 'val tmp_3: kotlin.collections.IndexedValue<@[NotNull(value = )] .P?> [val] declared in .test4' type=kotlin.collections.IndexedValue<@[NotNull(value = )] .P?> origin=null + VAR name:y type:@[NotNull(value = )] .P? [val] + CALL 'public final fun component2 (): T of kotlin.collections.IndexedValue [operator] declared in kotlin.collections.IndexedValue' type=@[NotNull(value = )] .P? origin=COMPONENT_N(index=2) + $this: GET_VAR 'val tmp_3: kotlin.collections.IndexedValue<@[NotNull(value = )] .P?> [val] declared in .test4' type=kotlin.collections.IndexedValue<@[NotNull(value = )] .P?> origin=null CALL 'public final fun use (x: kotlin.Any, y: kotlin.Any): kotlin.Unit declared in ' type=kotlin.Unit origin=null x: GET_VAR 'val x: kotlin.Int [val] declared in .test4' type=kotlin.Int origin=null y: TYPE_OP type=@[NotNull(value = )] .P origin=IMPLICIT_NOTNULL typeOperand=@[NotNull(value = )] .P - GET_VAR 'val y: @[NotNull(value = )] .P [val] declared in .test4' type=@[NotNull(value = )] .P origin=null + GET_VAR 'val y: @[NotNull(value = )] .P? [val] declared in .test4' type=@[NotNull(value = )] .P? origin=null diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.txt index 7cd206d3ed7..d940e2f0e0f 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.txt @@ -5,120 +5,120 @@ FILE fqName: fileName:/enhancedNullabilityInForLoop.kt FUN name:testForInListUnused visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY BLOCK type=kotlin.Unit origin=FOR_LOOP - VAR FOR_LOOP_ITERATOR name:tmp_0 type:kotlin.collections.MutableIterator<@[NotNull(value = )] .P> [val] - CALL 'public abstract fun iterator (): kotlin.collections.MutableIterator [fake_override,operator] declared in kotlin.collections.MutableList' type=kotlin.collections.MutableIterator<@[NotNull(value = )] .P> origin=FOR_LOOP_ITERATOR + VAR FOR_LOOP_ITERATOR name:tmp_0 type:kotlin.collections.MutableIterator<@[NotNull(value = )] .P?> [val] + CALL 'public abstract fun iterator (): kotlin.collections.MutableIterator [fake_override,operator] declared in kotlin.collections.MutableList' type=kotlin.collections.MutableIterator<@[NotNull(value = )] .P?> origin=FOR_LOOP_ITERATOR $this: TYPE_OP type=kotlin.collections.MutableList<*> origin=IMPLICIT_CAST typeOperand=kotlin.collections.MutableList<*> - TYPE_OP type=kotlin.collections.List<@[NotNull(value = )] .P> origin=IMPLICIT_NOTNULL typeOperand=kotlin.collections.List<@[NotNull(value = )] .P> - CALL 'public open fun listOfNotNull (): kotlin.collections.List<@[NotNull(value = )] .P>? declared in .J' type=kotlin.collections.List<@[NotNull(value = )] .P>? origin=null + TYPE_OP type=kotlin.collections.List<@[NotNull(value = )] .P?> origin=IMPLICIT_NOTNULL typeOperand=kotlin.collections.List<@[NotNull(value = )] .P?> + CALL 'public open fun listOfNotNull (): kotlin.collections.List<@[NotNull(value = )] .P?>? declared in .J' type=kotlin.collections.List<@[NotNull(value = )] .P?>? origin=null WHILE label=null origin=FOR_LOOP_INNER_WHILE condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [fake_override,operator] declared in kotlin.collections.MutableIterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT - $this: GET_VAR 'val tmp_0: kotlin.collections.MutableIterator<@[NotNull(value = )] .P> [val] declared in .testForInListUnused' type=kotlin.collections.MutableIterator<@[NotNull(value = )] .P> origin=null + $this: GET_VAR 'val tmp_0: kotlin.collections.MutableIterator<@[NotNull(value = )] .P?> [val] declared in .testForInListUnused' type=kotlin.collections.MutableIterator<@[NotNull(value = )] .P?> origin=null body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE - VAR FOR_LOOP_VARIABLE name:x type:@[NotNull(value = )] .P [val] - CALL 'public abstract fun next (): T of kotlin.collections.MutableIterator [fake_override,operator] declared in kotlin.collections.MutableIterator' type=@[NotNull(value = )] .P origin=FOR_LOOP_NEXT - $this: GET_VAR 'val tmp_0: kotlin.collections.MutableIterator<@[NotNull(value = )] .P> [val] declared in .testForInListUnused' type=kotlin.collections.MutableIterator<@[NotNull(value = )] .P> origin=null + VAR FOR_LOOP_VARIABLE name:x type:@[NotNull(value = )] .P? [val] + CALL 'public abstract fun next (): T of kotlin.collections.MutableIterator [fake_override,operator] declared in kotlin.collections.MutableIterator' type=@[NotNull(value = )] .P? origin=FOR_LOOP_NEXT + $this: GET_VAR 'val tmp_0: kotlin.collections.MutableIterator<@[NotNull(value = )] .P?> [val] declared in .testForInListUnused' type=kotlin.collections.MutableIterator<@[NotNull(value = )] .P?> origin=null BLOCK type=kotlin.Unit origin=null FUN name:testForInListDestructured visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY BLOCK type=kotlin.Unit origin=FOR_LOOP - VAR FOR_LOOP_ITERATOR name:tmp_1 type:kotlin.collections.MutableIterator<@[NotNull(value = )] .P> [val] - CALL 'public abstract fun iterator (): kotlin.collections.MutableIterator [fake_override,operator] declared in kotlin.collections.MutableList' type=kotlin.collections.MutableIterator<@[NotNull(value = )] .P> origin=FOR_LOOP_ITERATOR + VAR FOR_LOOP_ITERATOR name:tmp_1 type:kotlin.collections.MutableIterator<@[NotNull(value = )] .P?> [val] + CALL 'public abstract fun iterator (): kotlin.collections.MutableIterator [fake_override,operator] declared in kotlin.collections.MutableList' type=kotlin.collections.MutableIterator<@[NotNull(value = )] .P?> origin=FOR_LOOP_ITERATOR $this: TYPE_OP type=kotlin.collections.MutableList<*> origin=IMPLICIT_CAST typeOperand=kotlin.collections.MutableList<*> - TYPE_OP type=kotlin.collections.List<@[NotNull(value = )] .P> origin=IMPLICIT_NOTNULL typeOperand=kotlin.collections.List<@[NotNull(value = )] .P> - CALL 'public open fun listOfNotNull (): kotlin.collections.List<@[NotNull(value = )] .P>? declared in .J' type=kotlin.collections.List<@[NotNull(value = )] .P>? origin=null + TYPE_OP type=kotlin.collections.List<@[NotNull(value = )] .P?> origin=IMPLICIT_NOTNULL typeOperand=kotlin.collections.List<@[NotNull(value = )] .P?> + CALL 'public open fun listOfNotNull (): kotlin.collections.List<@[NotNull(value = )] .P?>? declared in .J' type=kotlin.collections.List<@[NotNull(value = )] .P?>? origin=null WHILE label=null origin=FOR_LOOP_INNER_WHILE condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [fake_override,operator] declared in kotlin.collections.MutableIterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT - $this: GET_VAR 'val tmp_1: kotlin.collections.MutableIterator<@[NotNull(value = )] .P> [val] declared in .testForInListDestructured' type=kotlin.collections.MutableIterator<@[NotNull(value = )] .P> origin=null + $this: GET_VAR 'val tmp_1: kotlin.collections.MutableIterator<@[NotNull(value = )] .P?> [val] declared in .testForInListDestructured' type=kotlin.collections.MutableIterator<@[NotNull(value = )] .P?> origin=null body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE - VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:@[NotNull(value = )] .P [val] - CALL 'public abstract fun next (): T of kotlin.collections.MutableIterator [fake_override,operator] declared in kotlin.collections.MutableIterator' type=@[NotNull(value = )] .P origin=FOR_LOOP_NEXT - $this: GET_VAR 'val tmp_1: kotlin.collections.MutableIterator<@[NotNull(value = )] .P> [val] declared in .testForInListDestructured' type=kotlin.collections.MutableIterator<@[NotNull(value = )] .P> origin=null + VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:@[NotNull(value = )] .P? [val] + CALL 'public abstract fun next (): T of kotlin.collections.MutableIterator [fake_override,operator] declared in kotlin.collections.MutableIterator' type=@[NotNull(value = )] .P? origin=FOR_LOOP_NEXT + $this: GET_VAR 'val tmp_1: kotlin.collections.MutableIterator<@[NotNull(value = )] .P?> [val] declared in .testForInListDestructured' type=kotlin.collections.MutableIterator<@[NotNull(value = )] .P?> origin=null VAR name:x type:kotlin.Int [val] CALL 'public final fun component1 (): kotlin.Int [operator] declared in .P' type=kotlin.Int origin=COMPONENT_N(index=1) $this: TYPE_OP type=@[NotNull(value = )] .P origin=IMPLICIT_NOTNULL typeOperand=@[NotNull(value = )] .P - GET_VAR 'val tmp_2: @[NotNull(value = )] .P [val] declared in .testForInListDestructured' type=@[NotNull(value = )] .P origin=null + GET_VAR 'val tmp_2: @[NotNull(value = )] .P? [val] declared in .testForInListDestructured' type=@[NotNull(value = )] .P? origin=null VAR name:y type:kotlin.Int [val] CALL 'public final fun component2 (): kotlin.Int [operator] declared in .P' type=kotlin.Int origin=COMPONENT_N(index=2) $this: TYPE_OP type=@[NotNull(value = )] .P origin=IMPLICIT_NOTNULL typeOperand=@[NotNull(value = )] .P - GET_VAR 'val tmp_2: @[NotNull(value = )] .P [val] declared in .testForInListDestructured' type=@[NotNull(value = )] .P origin=null + GET_VAR 'val tmp_2: @[NotNull(value = )] .P? [val] declared in .testForInListDestructured' type=@[NotNull(value = )] .P? origin=null BLOCK type=kotlin.Unit origin=null FUN name:testDesugaredForInList visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY - VAR name:iterator type:kotlin.collections.MutableIterator<@[NotNull(value = )] .P> [val] - CALL 'public abstract fun iterator (): kotlin.collections.MutableIterator [fake_override,operator] declared in kotlin.collections.MutableList' type=kotlin.collections.MutableIterator<@[NotNull(value = )] .P> origin=null + VAR name:iterator type:kotlin.collections.MutableIterator<@[NotNull(value = )] .P?> [val] + CALL 'public abstract fun iterator (): kotlin.collections.MutableIterator [fake_override,operator] declared in kotlin.collections.MutableList' type=kotlin.collections.MutableIterator<@[NotNull(value = )] .P?> origin=null $this: TYPE_OP type=kotlin.collections.MutableList<*> origin=IMPLICIT_CAST typeOperand=kotlin.collections.MutableList<*> - TYPE_OP type=kotlin.collections.List<@[NotNull(value = )] .P> origin=IMPLICIT_NOTNULL typeOperand=kotlin.collections.List<@[NotNull(value = )] .P> - CALL 'public open fun listOfNotNull (): kotlin.collections.List<@[NotNull(value = )] .P>? declared in .J' type=kotlin.collections.List<@[NotNull(value = )] .P>? origin=null + TYPE_OP type=kotlin.collections.List<@[NotNull(value = )] .P?> origin=IMPLICIT_NOTNULL typeOperand=kotlin.collections.List<@[NotNull(value = )] .P?> + CALL 'public open fun listOfNotNull (): kotlin.collections.List<@[NotNull(value = )] .P?>? declared in .J' type=kotlin.collections.List<@[NotNull(value = )] .P?>? origin=null WHILE label=null origin=WHILE_LOOP condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [fake_override,operator] declared in kotlin.collections.MutableIterator' type=kotlin.Boolean origin=null - $this: GET_VAR 'val iterator: kotlin.collections.MutableIterator<@[NotNull(value = )] .P> [val] declared in .testDesugaredForInList' type=kotlin.collections.MutableIterator<@[NotNull(value = )] .P> origin=null + $this: GET_VAR 'val iterator: kotlin.collections.MutableIterator<@[NotNull(value = )] .P?> [val] declared in .testDesugaredForInList' type=kotlin.collections.MutableIterator<@[NotNull(value = )] .P?> origin=null body: BLOCK type=kotlin.Unit origin=null VAR name:x type:@[NotNull(value = )] .P [val] TYPE_OP type=@[NotNull(value = )] .P origin=IMPLICIT_NOTNULL typeOperand=@[NotNull(value = )] .P - CALL 'public abstract fun next (): T of kotlin.collections.MutableIterator [fake_override,operator] declared in kotlin.collections.MutableIterator' type=@[NotNull(value = )] .P origin=null - $this: GET_VAR 'val iterator: kotlin.collections.MutableIterator<@[NotNull(value = )] .P> [val] declared in .testDesugaredForInList' type=kotlin.collections.MutableIterator<@[NotNull(value = )] .P> origin=null + CALL 'public abstract fun next (): T of kotlin.collections.MutableIterator [fake_override,operator] declared in kotlin.collections.MutableIterator' type=@[NotNull(value = )] .P? origin=null + $this: GET_VAR 'val iterator: kotlin.collections.MutableIterator<@[NotNull(value = )] .P?> [val] declared in .testDesugaredForInList' type=kotlin.collections.MutableIterator<@[NotNull(value = )] .P?> origin=null FUN name:testForInArrayUnused visibility:public modality:FINAL <> (j:.J) returnType:kotlin.Unit VALUE_PARAMETER name:j index:0 type:.J BLOCK_BODY BLOCK type=kotlin.Unit origin=FOR_LOOP - VAR FOR_LOOP_ITERATOR name:tmp_3 type:kotlin.collections.Iterator<.P> [val] - CALL 'public final fun iterator (): kotlin.collections.Iterator [operator] declared in kotlin.Array' type=kotlin.collections.Iterator<.P> origin=FOR_LOOP_ITERATOR - $this: TYPE_OP type=kotlin.Array<.P> origin=IMPLICIT_CAST typeOperand=kotlin.Array<.P> - TYPE_OP type=kotlin.Array.P> origin=IMPLICIT_NOTNULL typeOperand=kotlin.Array.P> - CALL 'public open fun arrayOfNotNull (): kotlin.Array.P> declared in .J' type=kotlin.Array.P> origin=null + VAR FOR_LOOP_ITERATOR name:tmp_3 type:kotlin.collections.Iterator<.P?> [val] + CALL 'public final fun iterator (): kotlin.collections.Iterator [operator] declared in kotlin.Array' type=kotlin.collections.Iterator<.P?> origin=FOR_LOOP_ITERATOR + $this: TYPE_OP type=kotlin.Array<.P?> origin=IMPLICIT_CAST typeOperand=kotlin.Array<.P?> + TYPE_OP type=kotlin.Array.P?> origin=IMPLICIT_NOTNULL typeOperand=kotlin.Array.P?> + CALL 'public open fun arrayOfNotNull (): kotlin.Array.P?>? declared in .J' type=kotlin.Array.P?>? origin=null $this: GET_VAR 'j: .J declared in .testForInArrayUnused' type=.J origin=null WHILE label=null origin=FOR_LOOP_INNER_WHILE condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [operator] declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT - $this: GET_VAR 'val tmp_3: kotlin.collections.Iterator<.P> [val] declared in .testForInArrayUnused' type=kotlin.collections.Iterator<.P> origin=null + $this: GET_VAR 'val tmp_3: kotlin.collections.Iterator<.P?> [val] declared in .testForInArrayUnused' type=kotlin.collections.Iterator<.P?> origin=null body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE - VAR FOR_LOOP_VARIABLE name:x type:.P [val] - CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=.P origin=FOR_LOOP_NEXT - $this: GET_VAR 'val tmp_3: kotlin.collections.Iterator<.P> [val] declared in .testForInArrayUnused' type=kotlin.collections.Iterator<.P> origin=null + VAR FOR_LOOP_VARIABLE name:x type:.P? [val] + CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=.P? origin=FOR_LOOP_NEXT + $this: GET_VAR 'val tmp_3: kotlin.collections.Iterator<.P?> [val] declared in .testForInArrayUnused' type=kotlin.collections.Iterator<.P?> origin=null BLOCK type=kotlin.Unit origin=null FUN name:testForInListUse visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY BLOCK type=kotlin.Unit origin=FOR_LOOP - VAR FOR_LOOP_ITERATOR name:tmp_4 type:kotlin.collections.MutableIterator<@[NotNull(value = )] .P> [val] - CALL 'public abstract fun iterator (): kotlin.collections.MutableIterator [fake_override,operator] declared in kotlin.collections.MutableList' type=kotlin.collections.MutableIterator<@[NotNull(value = )] .P> origin=FOR_LOOP_ITERATOR + VAR FOR_LOOP_ITERATOR name:tmp_4 type:kotlin.collections.MutableIterator<@[NotNull(value = )] .P?> [val] + CALL 'public abstract fun iterator (): kotlin.collections.MutableIterator [fake_override,operator] declared in kotlin.collections.MutableList' type=kotlin.collections.MutableIterator<@[NotNull(value = )] .P?> origin=FOR_LOOP_ITERATOR $this: TYPE_OP type=kotlin.collections.MutableList<*> origin=IMPLICIT_CAST typeOperand=kotlin.collections.MutableList<*> - TYPE_OP type=kotlin.collections.List<@[NotNull(value = )] .P> origin=IMPLICIT_NOTNULL typeOperand=kotlin.collections.List<@[NotNull(value = )] .P> - CALL 'public open fun listOfNotNull (): kotlin.collections.List<@[NotNull(value = )] .P>? declared in .J' type=kotlin.collections.List<@[NotNull(value = )] .P>? origin=null + TYPE_OP type=kotlin.collections.List<@[NotNull(value = )] .P?> origin=IMPLICIT_NOTNULL typeOperand=kotlin.collections.List<@[NotNull(value = )] .P?> + CALL 'public open fun listOfNotNull (): kotlin.collections.List<@[NotNull(value = )] .P?>? declared in .J' type=kotlin.collections.List<@[NotNull(value = )] .P?>? origin=null WHILE label=null origin=FOR_LOOP_INNER_WHILE condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [fake_override,operator] declared in kotlin.collections.MutableIterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT - $this: GET_VAR 'val tmp_4: kotlin.collections.MutableIterator<@[NotNull(value = )] .P> [val] declared in .testForInListUse' type=kotlin.collections.MutableIterator<@[NotNull(value = )] .P> origin=null + $this: GET_VAR 'val tmp_4: kotlin.collections.MutableIterator<@[NotNull(value = )] .P?> [val] declared in .testForInListUse' type=kotlin.collections.MutableIterator<@[NotNull(value = )] .P?> origin=null body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE - VAR FOR_LOOP_VARIABLE name:x type:@[NotNull(value = )] .P [val] - CALL 'public abstract fun next (): T of kotlin.collections.MutableIterator [fake_override,operator] declared in kotlin.collections.MutableIterator' type=@[NotNull(value = )] .P origin=FOR_LOOP_NEXT - $this: GET_VAR 'val tmp_4: kotlin.collections.MutableIterator<@[NotNull(value = )] .P> [val] declared in .testForInListUse' type=kotlin.collections.MutableIterator<@[NotNull(value = )] .P> origin=null + VAR FOR_LOOP_VARIABLE name:x type:@[NotNull(value = )] .P? [val] + CALL 'public abstract fun next (): T of kotlin.collections.MutableIterator [fake_override,operator] declared in kotlin.collections.MutableIterator' type=@[NotNull(value = )] .P? origin=FOR_LOOP_NEXT + $this: GET_VAR 'val tmp_4: kotlin.collections.MutableIterator<@[NotNull(value = )] .P?> [val] declared in .testForInListUse' type=kotlin.collections.MutableIterator<@[NotNull(value = )] .P?> origin=null BLOCK type=kotlin.Unit origin=null CALL 'public final fun use (s: .P): kotlin.Unit declared in ' type=kotlin.Unit origin=null s: TYPE_OP type=@[NotNull(value = )] .P origin=IMPLICIT_NOTNULL typeOperand=@[NotNull(value = )] .P - GET_VAR 'val x: @[NotNull(value = )] .P [val] declared in .testForInListUse' type=@[NotNull(value = )] .P origin=null - CALL 'public open fun use (s: .P): kotlin.Unit declared in .J' type=kotlin.Unit origin=null - s: GET_VAR 'val x: @[NotNull(value = )] .P [val] declared in .testForInListUse' type=@[NotNull(value = )] .P origin=null + GET_VAR 'val x: @[NotNull(value = )] .P? [val] declared in .testForInListUse' type=@[NotNull(value = )] .P? origin=null + CALL 'public open fun use (s: .P?): kotlin.Unit declared in .J' type=kotlin.Unit origin=null + s: GET_VAR 'val x: @[NotNull(value = )] .P? [val] declared in .testForInListUse' type=@[NotNull(value = )] .P? origin=null FUN name:testForInArrayUse visibility:public modality:FINAL <> (j:.J) returnType:kotlin.Unit VALUE_PARAMETER name:j index:0 type:.J BLOCK_BODY BLOCK type=kotlin.Unit origin=FOR_LOOP - VAR FOR_LOOP_ITERATOR name:tmp_5 type:kotlin.collections.Iterator<.P> [val] - CALL 'public final fun iterator (): kotlin.collections.Iterator [operator] declared in kotlin.Array' type=kotlin.collections.Iterator<.P> origin=FOR_LOOP_ITERATOR - $this: TYPE_OP type=kotlin.Array<.P> origin=IMPLICIT_CAST typeOperand=kotlin.Array<.P> - TYPE_OP type=kotlin.Array.P> origin=IMPLICIT_NOTNULL typeOperand=kotlin.Array.P> - CALL 'public open fun arrayOfNotNull (): kotlin.Array.P> declared in .J' type=kotlin.Array.P> origin=null + VAR FOR_LOOP_ITERATOR name:tmp_5 type:kotlin.collections.Iterator<.P?> [val] + CALL 'public final fun iterator (): kotlin.collections.Iterator [operator] declared in kotlin.Array' type=kotlin.collections.Iterator<.P?> origin=FOR_LOOP_ITERATOR + $this: TYPE_OP type=kotlin.Array<.P?> origin=IMPLICIT_CAST typeOperand=kotlin.Array<.P?> + TYPE_OP type=kotlin.Array.P?> origin=IMPLICIT_NOTNULL typeOperand=kotlin.Array.P?> + CALL 'public open fun arrayOfNotNull (): kotlin.Array.P?>? declared in .J' type=kotlin.Array.P?>? origin=null $this: GET_VAR 'j: .J declared in .testForInArrayUse' type=.J origin=null WHILE label=null origin=FOR_LOOP_INNER_WHILE condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [operator] declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT - $this: GET_VAR 'val tmp_5: kotlin.collections.Iterator<.P> [val] declared in .testForInArrayUse' type=kotlin.collections.Iterator<.P> origin=null + $this: GET_VAR 'val tmp_5: kotlin.collections.Iterator<.P?> [val] declared in .testForInArrayUse' type=kotlin.collections.Iterator<.P?> origin=null body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE - VAR FOR_LOOP_VARIABLE name:x type:.P [val] - CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=.P origin=FOR_LOOP_NEXT - $this: GET_VAR 'val tmp_5: kotlin.collections.Iterator<.P> [val] declared in .testForInArrayUse' type=kotlin.collections.Iterator<.P> origin=null + VAR FOR_LOOP_VARIABLE name:x type:.P? [val] + CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=.P? origin=FOR_LOOP_NEXT + $this: GET_VAR 'val tmp_5: kotlin.collections.Iterator<.P?> [val] declared in .testForInArrayUse' type=kotlin.collections.Iterator<.P?> origin=null BLOCK type=kotlin.Unit origin=null CALL 'public final fun use (s: .P): kotlin.Unit declared in ' type=kotlin.Unit origin=null s: TYPE_OP type=.P origin=IMPLICIT_NOTNULL typeOperand=.P - GET_VAR 'val x: .P [val] declared in .testForInArrayUse' type=.P origin=null - CALL 'public open fun use (s: .P): kotlin.Unit declared in .J' type=kotlin.Unit origin=null - s: GET_VAR 'val x: .P [val] declared in .testForInArrayUse' type=.P origin=null + GET_VAR 'val x: .P? [val] declared in .testForInArrayUse' type=.P? origin=null + CALL 'public open fun use (s: .P?): kotlin.Unit declared in .J' type=kotlin.Unit origin=null + s: GET_VAR 'val x: .P? [val] declared in .testForInArrayUse' type=.P? origin=null CLASS INTERFACE name:K modality:ABSTRACT visibility:public superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.K FUN name:arrayOfNotNull visibility:public modality:ABSTRACT <> ($this:.K) returnType:kotlin.Array<.P>