diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/irTypes.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/irTypes.kt index f59e38537a8..bdb79b6110f 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/irTypes.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/irTypes.kt @@ -22,7 +22,13 @@ fun IrType.withHasQuestionMark(hasQuestionMark: Boolean): IrType = if (this.hasQuestionMark == hasQuestionMark) this else - IrSimpleTypeImpl(originalKotlinType, classifier, hasQuestionMark, arguments, annotations) + IrSimpleTypeImpl( + makeKotlinType(classifier, arguments, hasQuestionMark), + classifier, + hasQuestionMark, + arguments, + annotations + ) else -> this } @@ -35,7 +41,7 @@ val IrType.classifierOrNull: IrClassifierSymbol? fun IrType.makeNotNull() = if (this is IrSimpleType && this.hasQuestionMark) IrSimpleTypeImpl( - originalKotlinType, + makeKotlinType(classifier, arguments, false), classifier, false, arguments, @@ -48,7 +54,7 @@ fun IrType.makeNotNull() = fun IrType.makeNullable() = if (this is IrSimpleType && !this.hasQuestionMark) IrSimpleTypeImpl( - originalKotlinType, + makeKotlinType(classifier, arguments, true), classifier, true, arguments, @@ -64,22 +70,26 @@ fun IrType.toKotlinType(): KotlinType { } return when (this) { - is IrSimpleType -> { - val classifier = classifier.descriptor - val arguments = arguments.mapIndexed { index, it -> - when (it) { - is IrTypeProjection -> TypeProjectionImpl(it.variance, it.type.toKotlinType()) - is IrStarProjection -> StarProjectionImpl((classifier as ClassDescriptor).declaredTypeParameters[index]) - else -> error(it) - } - } - - classifier.defaultType.replace(newArguments = arguments).makeNullableAsSpecified(hasQuestionMark) - } + is IrSimpleType -> makeKotlinType(classifier, arguments, hasQuestionMark) else -> TODO(toString()) } } +private fun makeKotlinType( + classifier: IrClassifierSymbol, + arguments: List, + hasQuestionMark: Boolean +): SimpleType { + val kotlinTypeArguments = arguments.mapIndexed { index, it -> + when (it) { + is IrTypeProjection -> TypeProjectionImpl(it.variance, it.type.toKotlinType()) + is IrStarProjection -> StarProjectionImpl((classifier.descriptor as ClassDescriptor).declaredTypeParameters[index]) + else -> error(it) + } + } + return classifier.descriptor.defaultType.replace(newArguments = kotlinTypeArguments).makeNullableAsSpecified(hasQuestionMark) +} + fun ClassifierDescriptor.toIrType(hasQuestionMark: Boolean = false): IrType { val symbol = getSymbol() return IrSimpleTypeImpl(defaultType, symbol, hasQuestionMark, listOf(), listOf()) diff --git a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.txt b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.txt index 23e82c29000..462af0ba0a7 100644 --- a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.txt +++ b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.txt @@ -624,7 +624,7 @@ FILE fqName: fileName:/dataClassWithArrayMembers.kt BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp1: Array?' type=kotlin.Array? origin=null - arg1: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null then: CONST Int type=kotlin.Int value=0 BRANCH if: CONST Boolean type=kotlin.Boolean value=true diff --git a/compiler/testData/ir/irText/classes/dataClasses.txt b/compiler/testData/ir/irText/classes/dataClasses.txt index 52f439d9893..f54094ae5c3 100644 --- a/compiler/testData/ir/irText/classes/dataClasses.txt +++ b/compiler/testData/ir/irText/classes/dataClasses.txt @@ -246,7 +246,7 @@ FILE fqName: fileName:/dataClasses.kt BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp1: Any?' type=kotlin.Any? origin=null - arg1: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null then: CONST Int type=kotlin.Int value=0 BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -441,7 +441,7 @@ FILE fqName: fileName:/dataClasses.kt BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp1: Double?' type=kotlin.Double? origin=null - arg1: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null then: CONST Int type=kotlin.Int value=0 BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -468,7 +468,7 @@ FILE fqName: fileName:/dataClasses.kt BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp2: Float?' type=kotlin.Float? origin=null - arg1: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null then: CONST Int type=kotlin.Int value=0 BRANCH if: CONST Boolean type=kotlin.Boolean value=true diff --git a/compiler/testData/ir/irText/classes/dataClassesGeneric.txt b/compiler/testData/ir/irText/classes/dataClassesGeneric.txt index 9555761a877..5c34d4ce39f 100644 --- a/compiler/testData/ir/irText/classes/dataClassesGeneric.txt +++ b/compiler/testData/ir/irText/classes/dataClassesGeneric.txt @@ -63,7 +63,7 @@ FILE fqName: fileName:/dataClassesGeneric.kt BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp1: T' type=T origin=null - arg1: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null then: CONST Int type=kotlin.Int value=0 BRANCH if: CONST Boolean type=kotlin.Boolean value=true diff --git a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.txt b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.txt index 69f14f2009a..4c1f7696737 100644 --- a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.txt +++ b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.txt @@ -92,7 +92,7 @@ FILE fqName: fileName:/dataClassMembers.kt BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp1: T' type=T origin=null - arg1: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null then: CONST Int type=kotlin.Int value=0 BRANCH if: CONST Boolean type=kotlin.Boolean value=true diff --git a/compiler/testData/ir/irText/expressions/bangbang.txt b/compiler/testData/ir/irText/expressions/bangbang.txt index 688fe874fbb..a4eb1c1f468 100644 --- a/compiler/testData/ir/irText/expressions/bangbang.txt +++ b/compiler/testData/ir/irText/expressions/bangbang.txt @@ -3,14 +3,14 @@ FILE fqName: fileName:/bangbang.kt VALUE_PARAMETER name:a index:0 type:kotlin.Any? flags: BLOCK_BODY RETURN type=kotlin.Nothing from='test1(Any?): Any' - BLOCK type=kotlin.Any? origin=EXCLEXCL + BLOCK type=kotlin.Any origin=EXCLEXCL VAR IR_TEMPORARY_VARIABLE name:tmp0_notnull type:kotlin.Any? flags:val GET_VAR 'value-parameter a: Any?' type=kotlin.Any? origin=null - WHEN type=kotlin.Any? origin=null + WHEN type=kotlin.Any origin=null BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_notnull: Any?' type=kotlin.Any? origin=null - arg1: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null then: CALL 'THROW_NPE(): Nothing' type=kotlin.Nothing origin=EXCLEXCL BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -20,16 +20,16 @@ FILE fqName: fileName:/bangbang.kt BLOCK_BODY RETURN type=kotlin.Nothing from='test2(Any?): Int' BLOCK type=kotlin.Int origin=EXCLEXCL - VAR IR_TEMPORARY_VARIABLE name:tmp1_notnull type:kotlin.Int flags:val - BLOCK type=kotlin.Int origin=SAFE_CALL + VAR IR_TEMPORARY_VARIABLE name:tmp1_notnull type:kotlin.Int? flags:val + BLOCK type=kotlin.Int? origin=SAFE_CALL VAR IR_TEMPORARY_VARIABLE name:tmp0_safe_receiver type:kotlin.Any? flags:val GET_VAR 'value-parameter a: Any?' type=kotlin.Any? origin=null - WHEN type=kotlin.Int origin=null + WHEN type=kotlin.Int? origin=null BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_safe_receiver: Any?' type=kotlin.Any? origin=null - arg1: CONST Null type=kotlin.Nothing value=null - then: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Null type=kotlin.Nothing? value=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'hashCode(): Int' type=kotlin.Int origin=null @@ -37,10 +37,10 @@ FILE fqName: fileName:/bangbang.kt WHEN type=kotlin.Int origin=null BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ - arg0: GET_VAR 'tmp1_notnull: Int' type=kotlin.Int origin=null - arg1: CONST Null type=kotlin.Nothing value=null + arg0: GET_VAR 'tmp1_notnull: Int?' type=kotlin.Int? origin=null + arg1: CONST Null type=kotlin.Nothing? value=null then: CALL 'THROW_NPE(): Nothing' type=kotlin.Nothing origin=EXCLEXCL BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: GET_VAR 'tmp1_notnull: Int' type=kotlin.Int origin=null + then: GET_VAR 'tmp1_notnull: Int?' type=kotlin.Int? origin=null diff --git a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.txt b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.txt index d9e482a3a9d..54c2d591cb7 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.txt @@ -13,7 +13,7 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_elvis_lhs: Boolean?' type=kotlin.Boolean? origin=null - arg1: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null then: BREAK label=null loop.label=L BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -32,7 +32,7 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_elvis_lhs: Boolean?' type=kotlin.Boolean? origin=null - arg1: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null then: CONTINUE label=null loop.label=L BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -53,7 +53,7 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_elvis_lhs: List?' type=kotlin.collections.List? origin=null - arg1: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null then: CONTINUE label=null loop.label=L BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -81,7 +81,7 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_elvis_lhs: List?' type=kotlin.collections.List? origin=null - arg1: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null then: BREAK label=null loop.label=L BRANCH if: CONST Boolean type=kotlin.Boolean value=true diff --git a/compiler/testData/ir/irText/expressions/chainOfSafeCalls.txt b/compiler/testData/ir/irText/expressions/chainOfSafeCalls.txt index 289ad4a83ea..ad894b994db 100644 --- a/compiler/testData/ir/irText/expressions/chainOfSafeCalls.txt +++ b/compiler/testData/ir/irText/expressions/chainOfSafeCalls.txt @@ -32,21 +32,21 @@ FILE fqName: fileName:/chainOfSafeCalls.kt VALUE_PARAMETER name:nc index:0 type:C? flags: BLOCK_BODY RETURN type=kotlin.Nothing from='test(C?): C?' - BLOCK type=C origin=SAFE_CALL - VAR IR_TEMPORARY_VARIABLE name:tmp3_safe_receiver type:C flags:val - BLOCK type=C origin=SAFE_CALL + BLOCK type=C? origin=SAFE_CALL + VAR IR_TEMPORARY_VARIABLE name:tmp3_safe_receiver type:C? flags:val + BLOCK type=C? origin=SAFE_CALL VAR IR_TEMPORARY_VARIABLE name:tmp2_safe_receiver type:C? flags:val BLOCK type=C? origin=SAFE_CALL - VAR IR_TEMPORARY_VARIABLE name:tmp1_safe_receiver type:C flags:val - BLOCK type=C origin=SAFE_CALL + VAR IR_TEMPORARY_VARIABLE name:tmp1_safe_receiver type:C? flags:val + BLOCK type=C? origin=SAFE_CALL VAR IR_TEMPORARY_VARIABLE name:tmp0_safe_receiver type:C? flags:val GET_VAR 'value-parameter nc: C?' type=C? origin=null - WHEN type=C origin=null + WHEN type=C? origin=null BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_safe_receiver: C?' type=C? origin=null - arg1: CONST Null type=kotlin.Nothing value=null - then: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Null type=kotlin.Nothing? value=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'foo(): C' type=C origin=null @@ -54,31 +54,31 @@ FILE fqName: fileName:/chainOfSafeCalls.kt WHEN type=C? origin=null BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ - arg0: GET_VAR 'tmp1_safe_receiver: C' type=C origin=null - arg1: CONST Null type=kotlin.Nothing value=null - then: CONST Null type=kotlin.Nothing value=null + arg0: GET_VAR 'tmp1_safe_receiver: C?' type=C? origin=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Null type=kotlin.Nothing? value=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'bar(): C?' type=C? origin=null - $this: GET_VAR 'tmp1_safe_receiver: C' type=C origin=null - WHEN type=C origin=null + $this: GET_VAR 'tmp1_safe_receiver: C?' type=C? origin=null + WHEN type=C? origin=null BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp2_safe_receiver: C?' type=C? origin=null - arg1: CONST Null type=kotlin.Nothing value=null - then: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Null type=kotlin.Nothing? value=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'foo(): C' type=C origin=null $this: GET_VAR 'tmp2_safe_receiver: C?' type=C? origin=null - WHEN type=C origin=null + WHEN type=C? origin=null BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ - arg0: GET_VAR 'tmp3_safe_receiver: C' type=C origin=null - arg1: CONST Null type=kotlin.Nothing value=null - then: CONST Null type=kotlin.Nothing value=null + arg0: GET_VAR 'tmp3_safe_receiver: C?' type=C? origin=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Null type=kotlin.Nothing? value=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'foo(): C' type=C origin=null - $this: GET_VAR 'tmp3_safe_receiver: C' type=C origin=null + $this: GET_VAR 'tmp3_safe_receiver: C?' type=C? origin=null diff --git a/compiler/testData/ir/irText/expressions/coercionToUnit.txt b/compiler/testData/ir/irText/expressions/coercionToUnit.txt index 1c67c747767..45a86993a78 100644 --- a/compiler/testData/ir/irText/expressions/coercionToUnit.txt +++ b/compiler/testData/ir/irText/expressions/coercionToUnit.txt @@ -25,32 +25,36 @@ FILE fqName: fileName:/coercionToUnit.kt element: CONST String type=kotlin.String value= FUN name:test3 visibility:public modality:FINAL <> () returnType:kotlin.Unit flags: BLOCK_BODY - BLOCK type=kotlin.Unit origin=SAFE_CALL - VAR IR_TEMPORARY_VARIABLE name:tmp0_safe_receiver type:java.io.PrintStream? flags:val - GET_FIELD 'out: PrintStream!' type=java.io.PrintStream? origin=GET_PROPERTY - WHEN type=kotlin.Unit origin=null - BRANCH - if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ - arg0: GET_VAR 'tmp0_safe_receiver: PrintStream?' type=java.io.PrintStream? origin=null - arg1: CONST Null type=kotlin.Nothing value=null - then: CONST Null type=kotlin.Nothing value=null - BRANCH - if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'println(String!): Unit' type=kotlin.Unit origin=null - $this: GET_VAR 'tmp0_safe_receiver: PrintStream?' type=java.io.PrintStream? origin=null - x: CONST String type=kotlin.String value=Hello, - BLOCK type=kotlin.Unit origin=SAFE_CALL - VAR IR_TEMPORARY_VARIABLE name:tmp1_safe_receiver type:java.io.PrintStream? flags:val - GET_FIELD 'out: PrintStream!' type=java.io.PrintStream? origin=GET_PROPERTY - WHEN type=kotlin.Unit origin=null - BRANCH - if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ - arg0: GET_VAR 'tmp1_safe_receiver: PrintStream?' type=java.io.PrintStream? origin=null - arg1: CONST Null type=kotlin.Nothing value=null - then: CONST Null type=kotlin.Nothing value=null - BRANCH - if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'println(String!): Unit' type=kotlin.Unit origin=null - $this: GET_VAR 'tmp1_safe_receiver: PrintStream?' type=java.io.PrintStream? origin=null - x: CONST String type=kotlin.String value=world! + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: superTypes:[kotlin.Any] + BLOCK type=kotlin.Unit? origin=SAFE_CALL + VAR IR_TEMPORARY_VARIABLE name:tmp0_safe_receiver type:java.io.PrintStream? flags:val + GET_FIELD 'out: PrintStream!' type=java.io.PrintStream? origin=GET_PROPERTY + WHEN type=kotlin.Unit? origin=null + BRANCH + if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ + arg0: GET_VAR 'tmp0_safe_receiver: PrintStream?' type=java.io.PrintStream? origin=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Null type=kotlin.Nothing? value=null + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: CALL 'println(String!): Unit' type=kotlin.Unit origin=null + $this: GET_VAR 'tmp0_safe_receiver: PrintStream?' type=java.io.PrintStream? origin=null + x: CONST String type=kotlin.String value=Hello, + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: superTypes:[kotlin.Any] + BLOCK type=kotlin.Unit? origin=SAFE_CALL + VAR IR_TEMPORARY_VARIABLE name:tmp1_safe_receiver type:java.io.PrintStream? flags:val + GET_FIELD 'out: PrintStream!' type=java.io.PrintStream? origin=GET_PROPERTY + WHEN type=kotlin.Unit? origin=null + BRANCH + if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ + arg0: GET_VAR 'tmp1_safe_receiver: PrintStream?' type=java.io.PrintStream? origin=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Null type=kotlin.Nothing? value=null + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: CALL 'println(String!): Unit' type=kotlin.Unit origin=null + $this: GET_VAR 'tmp1_safe_receiver: PrintStream?' type=java.io.PrintStream? origin=null + x: CONST String type=kotlin.String value=world! diff --git a/compiler/testData/ir/irText/expressions/dotQualified.txt b/compiler/testData/ir/irText/expressions/dotQualified.txt index 80b21e0fe5b..997e3caa883 100644 --- a/compiler/testData/ir/irText/expressions/dotQualified.txt +++ b/compiler/testData/ir/irText/expressions/dotQualified.txt @@ -9,15 +9,15 @@ FILE fqName: fileName:/dotQualified.kt VALUE_PARAMETER name:s index:0 type:kotlin.String? flags: BLOCK_BODY RETURN type=kotlin.Nothing from='lengthN(String?): Int?' - BLOCK type=kotlin.Int origin=SAFE_CALL + BLOCK type=kotlin.Int? origin=SAFE_CALL VAR IR_TEMPORARY_VARIABLE name:tmp0_safe_receiver type:kotlin.String? flags:val GET_VAR 'value-parameter s: String?' type=kotlin.String? origin=null - WHEN type=kotlin.Int origin=null + WHEN type=kotlin.Int? origin=null BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null - arg1: CONST Null type=kotlin.Nothing value=null - then: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Null type=kotlin.Nothing? value=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY diff --git a/compiler/testData/ir/irText/expressions/elvis.txt b/compiler/testData/ir/irText/expressions/elvis.txt index 1d4eef968ef..7c37e764e29 100644 --- a/compiler/testData/ir/irText/expressions/elvis.txt +++ b/compiler/testData/ir/irText/expressions/elvis.txt @@ -24,7 +24,7 @@ FILE fqName: fileName:/elvis.kt BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_elvis_lhs: Any?' type=kotlin.Any? origin=null - arg1: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null then: GET_VAR 'value-parameter b: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -41,7 +41,7 @@ FILE fqName: fileName:/elvis.kt BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_elvis_lhs: String?' type=kotlin.String? origin=null - arg1: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null then: GET_VAR 'value-parameter b: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -72,7 +72,7 @@ FILE fqName: fileName:/elvis.kt BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_elvis_lhs: Any?' type=kotlin.Any? origin=null - arg1: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null then: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:String modality:FINAL visibility:public flags: superTypes:[kotlin.Comparable; kotlin.CharSequence; java.io.Serializable] GET_VAR 'value-parameter b: Any?' type=kotlin.Any? origin=null @@ -92,7 +92,7 @@ FILE fqName: fileName:/elvis.kt BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_elvis_lhs: Any?' type=kotlin.Any? origin=null - arg1: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null then: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true @@ -108,7 +108,7 @@ FILE fqName: fileName:/elvis.kt BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_elvis_lhs: Any?' type=kotlin.Any? origin=null - arg1: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null then: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true diff --git a/compiler/testData/ir/irText/expressions/extFunSafeInvoke.txt b/compiler/testData/ir/irText/expressions/extFunSafeInvoke.txt index 8312929bb3b..be19c701986 100644 --- a/compiler/testData/ir/irText/expressions/extFunSafeInvoke.txt +++ b/compiler/testData/ir/irText/expressions/extFunSafeInvoke.txt @@ -4,15 +4,15 @@ FILE fqName: fileName:/extFunSafeInvoke.kt VALUE_PARAMETER name:fn index:1 type:kotlin.Any.(kotlin.Int, kotlin.String) -> kotlin.Unit flags: BLOCK_BODY RETURN type=kotlin.Nothing from='test(Any?, Any.(Int, String) -> Unit): Unit?' - BLOCK type=kotlin.Unit origin=SAFE_CALL + BLOCK type=kotlin.Unit? origin=SAFE_CALL VAR IR_TEMPORARY_VARIABLE name:tmp0_safe_receiver type:kotlin.Any? flags:val GET_VAR 'value-parameter receiver: Any?' type=kotlin.Any? origin=null - WHEN type=kotlin.Unit origin=null + WHEN type=kotlin.Unit? origin=null BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_safe_receiver: Any?' type=kotlin.Any? origin=null - arg1: CONST Null type=kotlin.Nothing value=null - then: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Null type=kotlin.Nothing? value=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'invoke(Any, Int, String): Unit' type=kotlin.Unit origin=INVOKE diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/eqeqRhsConditionPossiblyAffectingLhs.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/eqeqRhsConditionPossiblyAffectingLhs.txt index 73973ef7f3a..722d8e7ba3e 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/eqeqRhsConditionPossiblyAffectingLhs.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/eqeqRhsConditionPossiblyAffectingLhs.txt @@ -10,14 +10,14 @@ FILE fqName: fileName:/eqeqRhsConditionPossiblyAffectingLhs.kt if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Double typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags: superTypes:[kotlin.Number; kotlin.Comparable; java.io.Serializable] GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null - then: BLOCK type=kotlin.Nothing? origin=EXCLEXCL + then: BLOCK type=kotlin.Nothing origin=EXCLEXCL VAR IR_TEMPORARY_VARIABLE name:tmp0_notnull type:kotlin.Nothing? flags:val CONST Null type=kotlin.Nothing? value=null - WHEN type=kotlin.Nothing? origin=null + WHEN type=kotlin.Nothing origin=null BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_notnull: Nothing?' type=kotlin.Nothing? origin=null - arg1: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null then: CALL 'THROW_NPE(): Nothing' type=kotlin.Nothing origin=EXCLEXCL BRANCH if: CONST Boolean type=kotlin.Boolean value=true diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.txt index 6798aa3713e..3f9d96ea583 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableAnyAsIntToDouble.txt @@ -10,15 +10,15 @@ FILE fqName: fileName:/nullableAnyAsIntToDouble.kt typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Int modality:FINAL visibility:public flags: superTypes:[kotlin.Number; kotlin.Comparable; java.io.Serializable] GET_VAR 'value-parameter x: Any?' type=kotlin.Any? origin=null then: CALL 'less(Double, Double): Boolean' type=kotlin.Boolean origin=LT - arg0: BLOCK type=kotlin.Double origin=SAFE_CALL + arg0: BLOCK type=kotlin.Double? origin=SAFE_CALL VAR IR_TEMPORARY_VARIABLE name:tmp0_safe_receiver type:kotlin.Any? flags:val GET_VAR 'value-parameter x: Any?' type=kotlin.Any? origin=null - WHEN type=kotlin.Double origin=null + WHEN type=kotlin.Double? origin=null BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_safe_receiver: Any?' type=kotlin.Any? origin=null - arg1: CONST Null type=kotlin.Nothing value=null - then: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Null type=kotlin.Nothing? value=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'toDouble(): Double' type=kotlin.Double origin=null diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.txt index ea7f6eb310c..518f880941e 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/nullableFloatingPointEqeq.txt @@ -19,15 +19,15 @@ FILE fqName: fileName:/nullableFloatingPointEqeq.kt GET_VAR 'value-parameter y: Any?' type=kotlin.Any? origin=null then: CALL 'ieee754equals(Double?, Double?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'value-parameter x: Double?' type=kotlin.Double? origin=null - arg1: BLOCK type=kotlin.Double origin=SAFE_CALL + arg1: BLOCK type=kotlin.Double? origin=SAFE_CALL VAR IR_TEMPORARY_VARIABLE name:tmp0_safe_receiver type:kotlin.Any? flags:val GET_VAR 'value-parameter y: Any?' type=kotlin.Any? origin=null - WHEN type=kotlin.Double origin=null + WHEN type=kotlin.Double? origin=null BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_safe_receiver: Any?' type=kotlin.Any? origin=null - arg1: CONST Null type=kotlin.Nothing value=null - then: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Null type=kotlin.Nothing? value=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'toDouble(): Double' type=kotlin.Double origin=null @@ -49,15 +49,15 @@ FILE fqName: fileName:/nullableFloatingPointEqeq.kt GET_VAR 'value-parameter y: Any?' type=kotlin.Any? origin=null then: CALL 'ieee754equals(Double?, Double?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'value-parameter x: Double?' type=kotlin.Double? origin=null - arg1: BLOCK type=kotlin.Double origin=SAFE_CALL + arg1: BLOCK type=kotlin.Double? origin=SAFE_CALL VAR IR_TEMPORARY_VARIABLE name:tmp0_safe_receiver type:kotlin.Any? flags:val GET_VAR 'value-parameter y: Any?' type=kotlin.Any? origin=null - WHEN type=kotlin.Double origin=null + WHEN type=kotlin.Double? origin=null BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_safe_receiver: Any?' type=kotlin.Any? origin=null - arg1: CONST Null type=kotlin.Nothing value=null - then: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Null type=kotlin.Nothing? value=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'toDouble(): Double' type=kotlin.Double origin=null @@ -86,15 +86,15 @@ FILE fqName: fileName:/nullableFloatingPointEqeq.kt if: CONST Boolean type=kotlin.Boolean value=true then: CONST Boolean type=kotlin.Boolean value=false then: CALL 'ieee754equals(Double?, Double?): Boolean' type=kotlin.Boolean origin=EQEQ - arg0: BLOCK type=kotlin.Double origin=SAFE_CALL + arg0: BLOCK type=kotlin.Double? origin=SAFE_CALL VAR IR_TEMPORARY_VARIABLE name:tmp0_safe_receiver type:kotlin.Any? flags:val GET_VAR 'value-parameter x: Any?' type=kotlin.Any? origin=null - WHEN type=kotlin.Double origin=null + WHEN type=kotlin.Double? origin=null BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_safe_receiver: Any?' type=kotlin.Any? origin=null - arg1: CONST Null type=kotlin.Nothing value=null - then: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Null type=kotlin.Nothing? value=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'toDouble(): Double' type=kotlin.Double origin=null diff --git a/compiler/testData/ir/irText/expressions/safeAssignment.txt b/compiler/testData/ir/irText/expressions/safeAssignment.txt index bc29c9a8a0c..5a30d74556f 100644 --- a/compiler/testData/ir/irText/expressions/safeAssignment.txt +++ b/compiler/testData/ir/irText/expressions/safeAssignment.txt @@ -48,8 +48,10 @@ FILE fqName: fileName:/safeAssignment.kt BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_safe_receiver: C?' type=C? origin=null - arg1: CONST Null type=kotlin.Nothing value=null - then: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: superTypes:[kotlin.Any] + CONST Null type=kotlin.Nothing? value=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL '(Int): Unit' type=kotlin.Unit origin=EQ diff --git a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.txt b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.txt index 36217237a48..cedd02d5885 100644 --- a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.txt +++ b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.txt @@ -34,15 +34,15 @@ FILE fqName:test fileName:/safeCallWithIncrementDecrement.kt $receiver: VALUE_PARAMETER name: type:kotlin.Int? flags: BLOCK_BODY RETURN type=kotlin.Nothing from='inc() on Int?: Int?' - BLOCK type=kotlin.Int origin=SAFE_CALL + BLOCK type=kotlin.Int? origin=SAFE_CALL VAR IR_TEMPORARY_VARIABLE name:tmp0_safe_receiver type:kotlin.Int? flags:val GET_VAR 'this@inc: Int?' type=kotlin.Int? origin=null - WHEN type=kotlin.Int origin=null + WHEN type=kotlin.Int? origin=null BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_safe_receiver: Int?' type=kotlin.Int? origin=null - arg1: CONST Null type=kotlin.Nothing value=null - then: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Null type=kotlin.Nothing? value=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'inc(): Int' type=kotlin.Int origin=null @@ -68,8 +68,10 @@ FILE fqName:test fileName:/safeCallWithIncrementDecrement.kt BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_safe_receiver: C?' type=test.C? origin=null - arg1: CONST Null type=kotlin.Nothing value=null - then: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: superTypes:[kotlin.Any] + CONST Null type=kotlin.Nothing? value=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit @@ -92,16 +94,16 @@ FILE fqName:test fileName:/safeCallWithIncrementDecrement.kt TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: superTypes:[kotlin.Any] BLOCK type=kotlin.Int origin=POSTFIX_INCR - VAR IR_TEMPORARY_VARIABLE name:tmp1_array type:kotlin.Int flags:val - BLOCK type=kotlin.Int origin=SAFE_CALL + VAR IR_TEMPORARY_VARIABLE name:tmp1_array type:kotlin.Int? flags:val + BLOCK type=kotlin.Int? origin=SAFE_CALL VAR IR_TEMPORARY_VARIABLE name:tmp0_safe_receiver type:test.C? flags:val GET_VAR 'value-parameter nc: C?' type=test.C? origin=null - WHEN type=kotlin.Int origin=null + WHEN type=kotlin.Int? origin=null BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_safe_receiver: C?' type=test.C? origin=null - arg1: CONST Null type=kotlin.Nothing value=null - then: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Null type=kotlin.Nothing? value=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL '() on C?: Int' type=kotlin.Int origin=GET_PROPERTY @@ -110,10 +112,10 @@ FILE fqName:test fileName:/safeCallWithIncrementDecrement.kt CONST Int type=kotlin.Int value=0 VAR IR_TEMPORARY_VARIABLE name:tmp3 type:kotlin.Int flags:val CALL 'get(Int) on Int?: Int' type=kotlin.Int origin=POSTFIX_INCR - $receiver: GET_VAR 'tmp1_array: Int' type=kotlin.Int origin=null + $receiver: GET_VAR 'tmp1_array: Int?' type=kotlin.Int? origin=null index: GET_VAR 'tmp2_index0: Int' type=kotlin.Int origin=null CALL 'set(Int, Int) on Int?: Unit' type=kotlin.Unit origin=POSTFIX_INCR - $receiver: GET_VAR 'tmp1_array: Int' type=kotlin.Int origin=null + $receiver: GET_VAR 'tmp1_array: Int?' type=kotlin.Int? origin=null index: GET_VAR 'tmp2_index0: Int' type=kotlin.Int origin=null value: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR $this: GET_VAR 'tmp3: Int' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/expressions/safeCalls.txt b/compiler/testData/ir/irText/expressions/safeCalls.txt index f1879c3cb68..2c44fb26719 100644 --- a/compiler/testData/ir/irText/expressions/safeCalls.txt +++ b/compiler/testData/ir/irText/expressions/safeCalls.txt @@ -64,15 +64,15 @@ FILE fqName: fileName:/safeCalls.kt VALUE_PARAMETER name:x index:0 type:kotlin.String? flags: BLOCK_BODY RETURN type=kotlin.Nothing from='test1(String?): Int?' - BLOCK type=kotlin.Int origin=SAFE_CALL + BLOCK type=kotlin.Int? origin=SAFE_CALL VAR IR_TEMPORARY_VARIABLE name:tmp0_safe_receiver type:kotlin.String? flags:val GET_VAR 'value-parameter x: String?' type=kotlin.String? origin=null - WHEN type=kotlin.Int origin=null + WHEN type=kotlin.Int? origin=null BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null - arg1: CONST Null type=kotlin.Nothing value=null - then: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Null type=kotlin.Nothing? value=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY @@ -81,15 +81,15 @@ FILE fqName: fileName:/safeCalls.kt VALUE_PARAMETER name:x index:0 type:kotlin.String? flags: BLOCK_BODY RETURN type=kotlin.Nothing from='test2(String?): Int?' - BLOCK type=kotlin.Int origin=SAFE_CALL + BLOCK type=kotlin.Int? origin=SAFE_CALL VAR IR_TEMPORARY_VARIABLE name:tmp0_safe_receiver type:kotlin.String? flags:val GET_VAR 'value-parameter x: String?' type=kotlin.String? origin=null - WHEN type=kotlin.Int origin=null + WHEN type=kotlin.Int? origin=null BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null - arg1: CONST Null type=kotlin.Nothing value=null - then: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Null type=kotlin.Nothing? value=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'hashCode(): Int' type=kotlin.Int origin=null @@ -99,15 +99,15 @@ FILE fqName: fileName:/safeCalls.kt VALUE_PARAMETER name:y index:1 type:kotlin.Any? flags: BLOCK_BODY RETURN type=kotlin.Nothing from='test3(String?, Any?): Boolean?' - BLOCK type=kotlin.Boolean origin=SAFE_CALL + BLOCK type=kotlin.Boolean? origin=SAFE_CALL VAR IR_TEMPORARY_VARIABLE name:tmp0_safe_receiver type:kotlin.String? flags:val GET_VAR 'value-parameter x: String?' type=kotlin.String? origin=null - WHEN type=kotlin.Boolean origin=null + WHEN type=kotlin.Boolean? origin=null BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null - arg1: CONST Null type=kotlin.Nothing value=null - then: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Null type=kotlin.Nothing? value=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'equals(Any?): Boolean' type=kotlin.Boolean origin=null @@ -123,8 +123,10 @@ FILE fqName: fileName:/safeCalls.kt BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_safe_receiver: Ref?' type=Ref? origin=null - arg1: CONST Null type=kotlin.Nothing value=null - then: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: superTypes:[kotlin.Any] + CONST Null type=kotlin.Nothing? value=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL '(Int): Unit' type=kotlin.Unit origin=EQ @@ -135,15 +137,15 @@ FILE fqName: fileName:/safeCalls.kt VALUE_PARAMETER name:s index:0 type:kotlin.String? flags: BLOCK_BODY RETURN type=kotlin.Nothing from='test5(String?) on IHost: Int?' - BLOCK type=kotlin.Int origin=SAFE_CALL + BLOCK type=kotlin.Int? origin=SAFE_CALL VAR IR_TEMPORARY_VARIABLE name:tmp0_safe_receiver type:kotlin.String? flags:val GET_VAR 'value-parameter s: String?' type=kotlin.String? origin=null - WHEN type=kotlin.Int origin=null + WHEN type=kotlin.Int? origin=null BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null - arg1: CONST Null type=kotlin.Nothing value=null - then: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Null type=kotlin.Nothing? value=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'extLength() on String: Int' type=kotlin.Int origin=null @@ -158,15 +160,15 @@ FILE fqName: fileName:/safeCalls.kt BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: superTypes:[kotlin.Any] - BLOCK type=kotlin.Int origin=SAFE_CALL + BLOCK type=kotlin.Int? origin=SAFE_CALL VAR IR_TEMPORARY_VARIABLE name:tmp0_safe_receiver type:kotlin.Int flags:val CONST Int type=kotlin.Int value=42 - WHEN type=kotlin.Int origin=null + WHEN type=kotlin.Int? origin=null BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_safe_receiver: Int' type=kotlin.Int origin=null - arg1: CONST Null type=kotlin.Nothing value=null - then: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Null type=kotlin.Nothing? value=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'foo() on Int: Int' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/expressions/variableAsFunctionCall.txt b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.txt index b5fc4ff4e82..36fe17fb4bb 100644 --- a/compiler/testData/ir/irText/expressions/variableAsFunctionCall.txt +++ b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.txt @@ -32,29 +32,29 @@ FILE fqName: fileName:/variableAsFunctionCall.kt VALUE_PARAMETER name:ns index:0 type:kotlin.String? flags: BLOCK_BODY RETURN type=kotlin.Nothing from='test4(String?): String?' - BLOCK type=kotlin.String origin=SAFE_CALL - VAR IR_TEMPORARY_VARIABLE name:tmp1_safe_receiver type:() -> kotlin.String flags:val - BLOCK type=() -> kotlin.String origin=SAFE_CALL + BLOCK type=kotlin.String? origin=SAFE_CALL + VAR IR_TEMPORARY_VARIABLE name:tmp1_safe_receiver type:(() -> kotlin.String)? flags:val + BLOCK type=(() -> kotlin.String)? origin=SAFE_CALL VAR IR_TEMPORARY_VARIABLE name:tmp0_safe_receiver type:kotlin.String? flags:val GET_VAR 'value-parameter ns: String?' type=kotlin.String? origin=null - WHEN type=() -> kotlin.String origin=null + WHEN type=(() -> kotlin.String)? origin=null BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null - arg1: CONST Null type=kotlin.Nothing value=null - then: CONST Null type=kotlin.Nothing value=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Null type=kotlin.Nothing? value=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'k() on String: () -> String' type=() -> kotlin.String origin=null $receiver: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null - WHEN type=kotlin.String origin=null + WHEN type=kotlin.String? origin=null BRANCH if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ - arg0: GET_VAR 'tmp1_safe_receiver: () -> String' type=() -> kotlin.String origin=null - arg1: CONST Null type=kotlin.Nothing value=null - then: CONST Null type=kotlin.Nothing value=null + arg0: GET_VAR 'tmp1_safe_receiver: (() -> String)?' type=(() -> kotlin.String)? origin=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Null type=kotlin.Nothing? value=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'invoke(): String' type=kotlin.String origin=null - $this: GET_VAR 'tmp1_safe_receiver: () -> String' type=() -> kotlin.String origin=null + $this: GET_VAR 'tmp1_safe_receiver: (() -> String)?' type=(() -> kotlin.String)? origin=null