diff --git a/compiler/fir/dump/src/org/jetbrains/kotlin/fir/dump/HtmlFirDump.kt b/compiler/fir/dump/src/org/jetbrains/kotlin/fir/dump/HtmlFirDump.kt index c4df15f4beb..fbdc1a73584 100644 --- a/compiler/fir/dump/src/org/jetbrains/kotlin/fir/dump/HtmlFirDump.kt +++ b/compiler/fir/dump/src/org/jetbrains/kotlin/fir/dump/HtmlFirDump.kt @@ -17,6 +17,7 @@ import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.expressions.impl.FirElseIfTrueCondition import org.jetbrains.kotlin.fir.expressions.FirWhenSubjectExpression +import org.jetbrains.kotlin.fir.expressions.impl.FirUncheckedNotNullCastImpl import org.jetbrains.kotlin.fir.expressions.impl.FirUnitExpression import org.jetbrains.kotlin.fir.references.FirErrorNamedReference import org.jetbrains.kotlin.fir.references.FirSimpleNamedReference @@ -990,6 +991,11 @@ class HtmlFirDump internal constructor(private var linkResolver: FirLinkResolver } } + private fun FlowContent.generate(makeNotNullCall: FirUncheckedNotNullCastImpl) { + generate(makeNotNullCall.expression) + keyword("!") + } + private fun FlowContent.generate(typeOperatorCall: FirTypeOperatorCall) { val (expression) = typeOperatorCall.arguments generate(expression) @@ -1178,6 +1184,7 @@ class HtmlFirDump internal constructor(private var linkResolver: FirLinkResolver generate(expression.expression) } is FirTypeOperatorCall -> generate(expression) + is FirUncheckedNotNullCastImpl -> generate(expression) is FirOperatorCall -> generate(expression) else -> inlineUnsupported(expression) } diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt index 9247e11845e..e8833fbc3ca 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt @@ -629,6 +629,11 @@ internal class Fir2IrVisitor( } } + override fun visitUncheckedNotNullCast(uncheckedNotNullCast: FirUncheckedNotNullCast, data: Any?): IrElement { + // TODO: Ensure correct + return uncheckedNotNullCast.expression.toIrExpression() + } + override fun visitWrappedArgumentExpression(wrappedArgumentExpression: FirWrappedArgumentExpression, data: Any?): IrElement { // TODO: change this temporary hack to something correct return wrappedArgumentExpression.expression.toIrExpression() diff --git a/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/ConversionUtils.kt b/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/ConversionUtils.kt index 8b131fb5f82..1ffe0552d21 100644 --- a/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/ConversionUtils.kt +++ b/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/ConversionUtils.kt @@ -197,7 +197,10 @@ internal fun FirExpression.generateNotNullOrOther( ) branches += FirWhenBranchImpl( session, other.psi, FirElseIfTrueCondition(session, psi), - FirSingleExpressionBlock(session, generateResolvedAccessExpression(session, psi, subjectVariable)) + FirSingleExpressionBlock( + session, + FirUncheckedNotNullCastImpl(session, psi, generateResolvedAccessExpression(session, psi, subjectVariable)) + ) ) } } diff --git a/compiler/fir/psi2fir/testData/rawBuilder/expressions/nullability.txt b/compiler/fir/psi2fir/testData/rawBuilder/expressions/nullability.txt index 077f1c780d6..a739cde972b 100644 --- a/compiler/fir/psi2fir/testData/rawBuilder/expressions/nullability.txt +++ b/compiler/fir/psi2fir/testData/rawBuilder/expressions/nullability.txt @@ -5,7 +5,7 @@ FILE: nullability.kt Int(42) } else -> { - R|/| + R|/|! } } @@ -16,7 +16,7 @@ FILE: nullability.kt throw KotlinNullPointerException#() } else -> { - R|/| + R|/|! } } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirBodyResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirBodyResolveTransformer.kt index b8cf503079b..495a47c29ac 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirBodyResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirBodyResolveTransformer.kt @@ -131,6 +131,17 @@ open class FirBodyResolveTransformer(val session: FirSession, val implicitTypeOn } } + override fun transformUncheckedNotNullCast( + uncheckedNotNullCast: FirUncheckedNotNullCast, + data: Any? + ): CompositeTransformResult { + val notNullCast = super.transformUncheckedNotNullCast(uncheckedNotNullCast, data).single as FirUncheckedNotNullCast + val resultType = notNullCast.expression.resultType + notNullCast.resultType = + resultType.withReplacedConeType(session, resultType.coneTypeUnsafe().withNullability(ConeNullability.NOT_NULL)) + return notNullCast.compose() + } + override fun transformTypeOperatorCall(typeOperatorCall: FirTypeOperatorCall, data: Any?): CompositeTransformResult { val symbolProvider = session.service() val resolved = super.transformTypeOperatorCall(typeOperatorCall, data).single diff --git a/compiler/fir/resolve/testData/resolve/stdlib/factoryFunctionOverloads.txt b/compiler/fir/resolve/testData/resolve/stdlib/factoryFunctionOverloads.txt index ed727668b6b..6f17aff1ab7 100644 --- a/compiler/fir/resolve/testData/resolve/stdlib/factoryFunctionOverloads.txt +++ b/compiler/fir/resolve/testData/resolve/stdlib/factoryFunctionOverloads.txt @@ -12,7 +12,7 @@ FILE: factoryFunctionOverloads.kt throw R|kotlin/KotlinNullPointerException.KotlinNullPointerException|() } else -> { - R|/| + R|/|! } } , R|/flag|) diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirRenderer.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirRenderer.kt index 0469d8fb01c..c7a9e7b2567 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirRenderer.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirRenderer.kt @@ -919,4 +919,9 @@ class FirRenderer(builder: StringBuilder) : FirVisitorVoid() { override fun visitErrorExpression(errorExpression: FirErrorExpression) { print("ERROR_EXPR(${errorExpression.reason})") } + + override fun visitUncheckedNotNullCast(uncheckedNotNullCast: FirUncheckedNotNullCast) { + uncheckedNotNullCast.expression.accept(this) + print("!") + } } diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirUncheckedNotNullCast.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirUncheckedNotNullCast.kt new file mode 100644 index 00000000000..48c2e05ae91 --- /dev/null +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirUncheckedNotNullCast.kt @@ -0,0 +1,14 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.fir.expressions + +import org.jetbrains.kotlin.fir.visitors.FirVisitor + +interface FirUncheckedNotNullCast : FirCall { + override fun accept(visitor: FirVisitor, data: D): R = visitor.visitUncheckedNotNullCast(this, data) + + val expression: FirExpression get() = arguments[0] +} \ No newline at end of file diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirUncheckedNotNullCastImpl.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirUncheckedNotNullCastImpl.kt new file mode 100644 index 00000000000..783873411e7 --- /dev/null +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirUncheckedNotNullCastImpl.kt @@ -0,0 +1,24 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.fir.expressions.impl + +import com.intellij.psi.PsiElement +import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.expressions.FirExpression +import org.jetbrains.kotlin.fir.expressions.FirUncheckedNotNullCast +import org.jetbrains.kotlin.fir.expressions.FirOperation +import org.jetbrains.kotlin.fir.types.FirTypeRef + +class FirUncheckedNotNullCastImpl( + session: FirSession, + psi: PsiElement?, + expression: FirExpression +) : FirAbstractCall(session, psi), FirUncheckedNotNullCast { + init { + arguments += expression + } +} + diff --git a/compiler/fir/tree/visitors/org/jetbrains/kotlin/fir/visitors/FirTransformerGenerated.kt b/compiler/fir/tree/visitors/org/jetbrains/kotlin/fir/visitors/FirTransformerGenerated.kt index f693dd07550..ed57fbfee5d 100644 --- a/compiler/fir/tree/visitors/org/jetbrains/kotlin/fir/visitors/FirTransformerGenerated.kt +++ b/compiler/fir/tree/visitors/org/jetbrains/kotlin/fir/visitors/FirTransformerGenerated.kt @@ -236,6 +236,10 @@ abstract class FirTransformer : FirVisitor { + return transformCall(uncheckedNotNullCast, data) + } + open fun transformClassReferenceExpression(classReferenceExpression: FirClassReferenceExpression, data: D): CompositeTransformResult { return transformExpression(classReferenceExpression, data) } @@ -732,6 +736,10 @@ abstract class FirTransformer : FirVisitor { + return transformUncheckedNotNullCast(uncheckedNotNullCast, data) + } + final override fun visitUserTypeRef(userTypeRef: FirUserTypeRef, data: D): CompositeTransformResult { return transformUserTypeRef(userTypeRef, data) } diff --git a/compiler/fir/tree/visitors/org/jetbrains/kotlin/fir/visitors/FirVisitorGenerated.kt b/compiler/fir/tree/visitors/org/jetbrains/kotlin/fir/visitors/FirVisitorGenerated.kt index b3c31fe081e..d22323dc2f5 100644 --- a/compiler/fir/tree/visitors/org/jetbrains/kotlin/fir/visitors/FirVisitorGenerated.kt +++ b/compiler/fir/tree/visitors/org/jetbrains/kotlin/fir/visitors/FirVisitorGenerated.kt @@ -236,6 +236,10 @@ abstract class FirVisitor { return visitCall(stringConcatenationCall, data) } + open fun visitUncheckedNotNullCast(uncheckedNotNullCast: FirUncheckedNotNullCast, data: D): R { + return visitCall(uncheckedNotNullCast, data) + } + open fun visitClassReferenceExpression(classReferenceExpression: FirClassReferenceExpression, data: D): R { return visitExpression(classReferenceExpression, data) } diff --git a/compiler/fir/tree/visitors/org/jetbrains/kotlin/fir/visitors/FirVisitorVoidGenerated.kt b/compiler/fir/tree/visitors/org/jetbrains/kotlin/fir/visitors/FirVisitorVoidGenerated.kt index a67c436968e..d1330c056fc 100644 --- a/compiler/fir/tree/visitors/org/jetbrains/kotlin/fir/visitors/FirVisitorVoidGenerated.kt +++ b/compiler/fir/tree/visitors/org/jetbrains/kotlin/fir/visitors/FirVisitorVoidGenerated.kt @@ -236,6 +236,10 @@ abstract class FirVisitorVoid : FirVisitor() { visitCall(stringConcatenationCall, null) } + open fun visitUncheckedNotNullCast(uncheckedNotNullCast: FirUncheckedNotNullCast) { + visitCall(uncheckedNotNullCast, null) + } + open fun visitClassReferenceExpression(classReferenceExpression: FirClassReferenceExpression) { visitExpression(classReferenceExpression, null) } @@ -732,6 +736,10 @@ abstract class FirVisitorVoid : FirVisitor() { visitTypedDeclaration(typedDeclaration) } + final override fun visitUncheckedNotNullCast(uncheckedNotNullCast: FirUncheckedNotNullCast, data: Nothing?) { + visitUncheckedNotNullCast(uncheckedNotNullCast) + } + final override fun visitUserTypeRef(userTypeRef: FirUserTypeRef, data: Nothing?) { visitUserTypeRef(userTypeRef) } diff --git a/compiler/testData/ir/irText/expressions/bangbang.fir.txt b/compiler/testData/ir/irText/expressions/bangbang.fir.txt index bd948b8304b..2711ddf53f8 100644 --- a/compiler/testData/ir/irText/expressions/bangbang.fir.txt +++ b/compiler/testData/ir/irText/expressions/bangbang.fir.txt @@ -1,12 +1,12 @@ FILE fqName: fileName:/bangbang.kt - FUN name:test1 visibility:public modality:FINAL <> (a:kotlin.Any?) returnType:kotlin.Any? + FUN name:test1 visibility:public modality:FINAL <> (a:kotlin.Any?) returnType:kotlin.Any VALUE_PARAMETER name:a index:0 type:kotlin.Any? BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun test1 (a: kotlin.Any?): kotlin.Any? declared in ' - BLOCK type=kotlin.Any? origin=EXCLEXCL + RETURN type=kotlin.Nothing from='public final fun test1 (a: kotlin.Any?): kotlin.Any declared in ' + BLOCK type=kotlin.Any origin=EXCLEXCL VAR name: type:kotlin.Any? [val] GET_VAR 'a: kotlin.Any? declared in .test1' type=kotlin.Any? origin=null - WHEN type=kotlin.Any? origin=EXCLEXCL + WHEN type=kotlin.Any origin=EXCLEXCL BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val : kotlin.Any? [val] declared in .test1' type=kotlin.Any? origin=null diff --git a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt index 8c7f3ff6722..f1cb6cbfcfa 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt @@ -45,11 +45,11 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt WHILE label=L origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value=true body: BLOCK type=kotlin.Unit origin=null - VAR name: type:kotlin.collections.List? [val] - BLOCK type=kotlin.collections.List? origin=ELVIS + VAR name: type:kotlin.collections.List [val] + BLOCK type=kotlin.collections.List origin=ELVIS VAR name: type:kotlin.collections.List? [val] GET_VAR 'ss: kotlin.collections.List? declared in .test3' type=kotlin.collections.List? origin=null - WHEN type=kotlin.collections.List? origin=ELVIS + WHEN type=kotlin.collections.List origin=ELVIS BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val : kotlin.collections.List? [val] declared in .test3' type=kotlin.collections.List? origin=null @@ -58,24 +58,27 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: GET_VAR 'val : kotlin.collections.List? [val] declared in .test3' type=kotlin.collections.List? origin=null - VAR name: type:IrErrorType [val] - ERROR_CALL 'Unresolved reference: #' type=IrErrorType + VAR name: type:kotlin.collections.Iterator [val] + CALL 'public abstract fun iterator (): kotlin.collections.Iterator declared in kotlin.collections.List' type=kotlin.collections.Iterator origin=null + $this: GET_VAR 'val : kotlin.collections.List [val] declared in .test3' type=kotlin.collections.List origin=null WHILE label=L2 origin=FOR_LOOP_INNER_WHILE - condition: ERROR_CALL 'Unresolved reference: #' type=IrErrorType + condition: CALL 'public abstract fun hasNext (): kotlin.Boolean declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=null + $this: GET_VAR 'val : kotlin.collections.Iterator [val] declared in .test3' type=kotlin.collections.Iterator origin=null body: BLOCK type=kotlin.Unit origin=null - VAR name:s type:IrErrorType [val] - ERROR_CALL 'Unresolved reference: #' type=IrErrorType + VAR name:s type:kotlin.String [val] + CALL 'public abstract fun next (): kotlin.String declared in kotlin.collections.Iterator' type=kotlin.String origin=null + $this: GET_VAR 'val : kotlin.collections.Iterator [val] declared in .test3' type=kotlin.collections.Iterator origin=null FUN name:test4 visibility:public modality:FINAL <> (ss:kotlin.collections.List?) returnType:kotlin.Unit VALUE_PARAMETER name:ss index:0 type:kotlin.collections.List? BLOCK_BODY WHILE label=L origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value=true body: BLOCK type=kotlin.Unit origin=null - VAR name: type:kotlin.collections.List? [val] - BLOCK type=kotlin.collections.List? origin=ELVIS + VAR name: type:kotlin.collections.List [val] + BLOCK type=kotlin.collections.List origin=ELVIS VAR name: type:kotlin.collections.List? [val] GET_VAR 'ss: kotlin.collections.List? declared in .test4' type=kotlin.collections.List? origin=null - WHEN type=kotlin.collections.List? origin=ELVIS + WHEN type=kotlin.collections.List origin=ELVIS BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val : kotlin.collections.List? [val] declared in .test4' type=kotlin.collections.List? origin=null @@ -84,13 +87,16 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: GET_VAR 'val : kotlin.collections.List? [val] declared in .test4' type=kotlin.collections.List? origin=null - VAR name: type:IrErrorType [val] - ERROR_CALL 'Unresolved reference: #' type=IrErrorType + VAR name: type:kotlin.collections.Iterator [val] + CALL 'public abstract fun iterator (): kotlin.collections.Iterator declared in kotlin.collections.List' type=kotlin.collections.Iterator origin=null + $this: GET_VAR 'val : kotlin.collections.List [val] declared in .test4' type=kotlin.collections.List origin=null WHILE label=L2 origin=FOR_LOOP_INNER_WHILE - condition: ERROR_CALL 'Unresolved reference: #' type=IrErrorType + condition: CALL 'public abstract fun hasNext (): kotlin.Boolean declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=null + $this: GET_VAR 'val : kotlin.collections.Iterator [val] declared in .test4' type=kotlin.collections.Iterator origin=null body: BLOCK type=kotlin.Unit origin=null - VAR name:s type:IrErrorType [val] - ERROR_CALL 'Unresolved reference: #' type=IrErrorType + VAR name:s type:kotlin.String [val] + CALL 'public abstract fun next (): kotlin.String declared in kotlin.collections.Iterator' type=kotlin.String origin=null + $this: GET_VAR 'val : kotlin.collections.Iterator [val] declared in .test4' type=kotlin.collections.Iterator origin=null FUN name:test5 visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY VAR name:i type:kotlin.Int [var] diff --git a/compiler/testData/ir/irText/expressions/elvis.fir.txt b/compiler/testData/ir/irText/expressions/elvis.fir.txt index ad5b94aad96..f6e36b54a60 100644 --- a/compiler/testData/ir/irText/expressions/elvis.fir.txt +++ b/compiler/testData/ir/irText/expressions/elvis.fir.txt @@ -12,15 +12,15 @@ FILE fqName: fileName:/elvis.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.Any? declared in ' CONST Null type=kotlin.Nothing? value=null - FUN name:test1 visibility:public modality:FINAL <> (a:kotlin.Any?, b:kotlin.Any) returnType:kotlin.Any? + FUN name:test1 visibility:public modality:FINAL <> (a:kotlin.Any?, b:kotlin.Any) returnType:kotlin.Any VALUE_PARAMETER name:a index:0 type:kotlin.Any? VALUE_PARAMETER name:b index:1 type:kotlin.Any BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun test1 (a: kotlin.Any?, b: kotlin.Any): kotlin.Any? declared in ' - BLOCK type=kotlin.Any? origin=ELVIS + RETURN type=kotlin.Nothing from='public final fun test1 (a: kotlin.Any?, b: kotlin.Any): kotlin.Any declared in ' + BLOCK type=kotlin.Any origin=ELVIS VAR name: type:kotlin.Any? [val] GET_VAR 'a: kotlin.Any? declared in .test1' type=kotlin.Any? origin=null - WHEN type=kotlin.Any? origin=ELVIS + WHEN type=kotlin.Any origin=ELVIS BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val : kotlin.Any? [val] declared in .test1' type=kotlin.Any? origin=null @@ -29,15 +29,15 @@ FILE fqName: fileName:/elvis.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: GET_VAR 'val : kotlin.Any? [val] declared in .test1' type=kotlin.Any? origin=null - FUN name:test2 visibility:public modality:FINAL <> (a:kotlin.String?, b:kotlin.Any) returnType:kotlin.Any? + FUN name:test2 visibility:public modality:FINAL <> (a:kotlin.String?, b:kotlin.Any) returnType:kotlin.Any VALUE_PARAMETER name:a index:0 type:kotlin.String? VALUE_PARAMETER name:b index:1 type:kotlin.Any BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun test2 (a: kotlin.String?, b: kotlin.Any): kotlin.Any? declared in ' - BLOCK type=kotlin.Any? origin=ELVIS + RETURN type=kotlin.Nothing from='public final fun test2 (a: kotlin.String?, b: kotlin.Any): kotlin.Any declared in ' + BLOCK type=kotlin.Any origin=ELVIS VAR name: type:kotlin.String? [val] GET_VAR 'a: kotlin.String? declared in .test2' type=kotlin.String? origin=null - WHEN type=kotlin.Any? origin=ELVIS + WHEN type=kotlin.Any origin=ELVIS BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val : kotlin.String? [val] declared in .test2' type=kotlin.String? origin=null @@ -75,14 +75,14 @@ FILE fqName: fileName:/elvis.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: GET_VAR 'val : kotlin.Any? [val] declared in .test3' type=kotlin.Any? origin=null - FUN name:test4 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:kotlin.Any? + FUN name:test4 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:kotlin.Any VALUE_PARAMETER name:x index:0 type:kotlin.Any BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun test4 (x: kotlin.Any): kotlin.Any? declared in ' - BLOCK type=kotlin.Any? origin=ELVIS + RETURN type=kotlin.Nothing from='public final fun test4 (x: kotlin.Any): kotlin.Any declared in ' + BLOCK type=kotlin.Any origin=ELVIS VAR name: type:kotlin.Any? [val] CALL 'public final fun (): kotlin.Any? declared in ' type=kotlin.Any? origin=null - WHEN type=kotlin.Any? origin=ELVIS + WHEN type=kotlin.Any origin=ELVIS BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val : kotlin.Any? [val] declared in .test4' type=kotlin.Any? origin=null @@ -91,14 +91,14 @@ FILE fqName: fileName:/elvis.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: GET_VAR 'val : kotlin.Any? [val] declared in .test4' type=kotlin.Any? origin=null - FUN name:test5 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:kotlin.Any? + FUN name:test5 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:kotlin.Any VALUE_PARAMETER name:x index:0 type:kotlin.Any BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun test5 (x: kotlin.Any): kotlin.Any? declared in ' - BLOCK type=kotlin.Any? origin=ELVIS + RETURN type=kotlin.Nothing from='public final fun test5 (x: kotlin.Any): kotlin.Any declared in ' + BLOCK type=kotlin.Any origin=ELVIS VAR name: type:kotlin.Any? [val] CALL 'public final fun foo (): kotlin.Any? declared in ' type=kotlin.Any? origin=null - WHEN type=kotlin.Any? origin=ELVIS + WHEN type=kotlin.Any origin=ELVIS BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val : kotlin.Any? [val] declared in .test5' type=kotlin.Any? origin=null diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/eqeqRhsConditionPossiblyAffectingLhs.fir.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/eqeqRhsConditionPossiblyAffectingLhs.fir.txt index 3d5449df675..b0fd0b73521 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/eqeqRhsConditionPossiblyAffectingLhs.fir.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/eqeqRhsConditionPossiblyAffectingLhs.fir.txt @@ -5,14 +5,14 @@ FILE fqName: fileName:/eqeqRhsConditionPossiblyAffectingLhs.kt RETURN type=kotlin.Nothing from='public final fun test (x: kotlin.Any): kotlin.Boolean declared in ' CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'x: kotlin.Any declared in .test' type=kotlin.Any origin=null - arg1: WHEN type=kotlin.Any? origin=IF + arg1: WHEN type=kotlin.Any origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Double GET_VAR 'x: kotlin.Any declared in .test' type=kotlin.Any origin=null - then: BLOCK type=kotlin.Nothing? origin=EXCLEXCL + then: BLOCK type=kotlin.Nothing origin=EXCLEXCL VAR name: type:kotlin.Nothing? [val] CONST Null type=kotlin.Nothing? value=null - WHEN type=kotlin.Nothing? origin=EXCLEXCL + WHEN type=kotlin.Nothing origin=EXCLEXCL BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val : kotlin.Nothing? [val] declared in .test' type=kotlin.Nothing? origin=null