From 73b1676a037f602307844cfa8266adf703993284 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Tue, 16 Apr 2019 14:38:44 +0300 Subject: [PATCH] Raw FIR: fix unary operators (now convention calls use receivers) --- .../kotlin/fir/builder/RawFirBuilder.kt | 7 +-- .../rawBuilder/expressions/namedArgument.txt | 2 +- .../testData/rawBuilder/expressions/unary.txt | 2 +- .../testData/resolve/stdlib/unaryOperators.kt | 18 ++++++++ .../resolve/stdlib/unaryOperators.txt | 21 +++++++++ ...FirResolveTestCaseWithStdlibGenerated.java | 5 +++ .../whenByFloatingPoint.fir.txt | 29 +++++------- .../ir/irText/expressions/ifElseIf.fir.txt | 5 +-- .../ir/irText/expressions/literals.fir.txt | 44 +++++++++---------- .../primitivesImplicitConversions.fir.txt | 3 +- .../expressions/simpleUnaryOperators.fir.txt | 42 ++++++++---------- .../whenWithSubjectVariable.fir.txt | 3 +- .../basicWithPrimitiveJava/jvm/jvm.txt | 4 +- 13 files changed, 106 insertions(+), 79 deletions(-) create mode 100644 compiler/fir/resolve/testData/resolve/stdlib/unaryOperators.kt create mode 100644 compiler/fir/resolve/testData/resolve/stdlib/unaryOperators.txt diff --git a/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt b/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt index a5f5a2ceadf..e62ad57f38f 100644 --- a/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt +++ b/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt @@ -1216,14 +1216,15 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) { calleeReference = FirSimpleNamedReference( this@RawFirBuilder.session, expression.operationReference, conventionCallName ) + explicitReceiver = argument.toFirExpression("No operand") } } else { val firOperation = operationToken.toFirOperation() FirOperatorCallImpl( session, expression, firOperation - ) - }.apply { - arguments += argument.toFirExpression("No operand") + ).apply { + arguments += argument.toFirExpression("No operand") + } } } diff --git a/compiler/fir/psi2fir/testData/rawBuilder/expressions/namedArgument.txt b/compiler/fir/psi2fir/testData/rawBuilder/expressions/namedArgument.txt index 52b73ba4065..786d20a8ef3 100644 --- a/compiler/fir/psi2fir/testData/rawBuilder/expressions/namedArgument.txt +++ b/compiler/fir/psi2fir/testData/rawBuilder/expressions/namedArgument.txt @@ -5,6 +5,6 @@ FILE: namedArgument.kt foo#() foo#(String(Alpha), Boolean(false), Double(2.71)) foo#(first = String(Hello), second = Boolean(true)) - foo#(third = unaryMinus#(Double(1.0)), first = String(123)) + foo#(third = Double(1.0).unaryMinus#(), first = String(123)) foo#(ERROR_EXPR(Argument is absent)) } diff --git a/compiler/fir/psi2fir/testData/rawBuilder/expressions/unary.txt b/compiler/fir/psi2fir/testData/rawBuilder/expressions/unary.txt index 5deb879b3bc..e857ff40d2c 100644 --- a/compiler/fir/psi2fir/testData/rawBuilder/expressions/unary.txt +++ b/compiler/fir/psi2fir/testData/rawBuilder/expressions/unary.txt @@ -26,7 +26,7 @@ FILE: unary.kt } when () { - not#(==(x#, Int(0))) -> { + ==(x#, Int(0)).not#() -> { println#(String(000)) } else -> { diff --git a/compiler/fir/resolve/testData/resolve/stdlib/unaryOperators.kt b/compiler/fir/resolve/testData/resolve/stdlib/unaryOperators.kt new file mode 100644 index 00000000000..8b6367438eb --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/stdlib/unaryOperators.kt @@ -0,0 +1,18 @@ +7class U { + operator fun contains(g: String): Boolean { + return false + } +} + + +fun foo(u: U) { + val b = false + val i = 10 + val x = -i + val y = !b + val z = -1.0 + val w = +i + + val g = "" !in u + val f = "" !is Boolean +} \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/stdlib/unaryOperators.txt b/compiler/fir/resolve/testData/resolve/stdlib/unaryOperators.txt new file mode 100644 index 00000000000..0d24e5dd7d4 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/stdlib/unaryOperators.txt @@ -0,0 +1,21 @@ +FILE: unaryOperators.kt + public final class U : R|kotlin/Any| { + public constructor(): R|U| { + super() + } + + public final operator fun contains(g: R|kotlin/String|): R|kotlin/Boolean| { + ^contains Boolean(false) + } + + } + public final fun foo(u: R|U|): R|kotlin/Unit| { + lval b: R|kotlin/Boolean| = Boolean(false) + lval i: R|kotlin/Int| = Int(10) + lval x: R|kotlin/Int| = R|/i|.R|kotlin/Int.unaryMinus|() + lval y: R|kotlin/Boolean| = R|/b|.R|kotlin/Boolean.not|() + lval z: R|kotlin/Double| = Double(1.0).R|kotlin/Double.unaryMinus|() + lval w: R|kotlin/Int| = R|/i|.R|kotlin/Int.unaryPlus|() + lval g: R|kotlin/Boolean| = R|/u|.R|/U.contains|(String()).R|kotlin/Boolean.not|() + lval f: R|kotlin/Boolean| = (String() !is R|kotlin/Boolean|) + } diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveTestCaseWithStdlibGenerated.java b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveTestCaseWithStdlibGenerated.java index d1135ba8694..20b6bf52cfd 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveTestCaseWithStdlibGenerated.java +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveTestCaseWithStdlibGenerated.java @@ -43,4 +43,9 @@ public class FirResolveTestCaseWithStdlibGenerated extends AbstractFirResolveTes public void testReflectionClass() throws Exception { runTest("compiler/fir/resolve/testData/resolve/stdlib/reflectionClass.kt"); } + + @TestMetadata("unaryOperators.kt") + public void testUnaryOperators() throws Exception { + runTest("compiler/fir/resolve/testData/resolve/stdlib/unaryOperators.kt"); + } } diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.fir.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.fir.txt index f364569b3ce..4af1f622214 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.fir.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.fir.txt @@ -22,8 +22,7 @@ FILE fqName: fileName:/whenByFloatingPoint.kt if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Double GET_VAR 'x: kotlin.Any declared in .testSmartCastInWhenSubject' type=kotlin.Any origin=null then: RETURN type=kotlin.Nothing from='public final fun testSmartCastInWhenSubject (x: kotlin.Any): kotlin.Int declared in ' - ERROR_CALL 'Unresolved reference: #' type=IrErrorType - CONST Int type=kotlin.Int value=1 + CALL 'public final fun unaryMinus (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null RETURN type=kotlin.Nothing from='public final fun testSmartCastInWhenSubject (x: kotlin.Any): kotlin.Int declared in ' BLOCK type=kotlin.Int origin=WHEN VAR IR_TEMPORARY_VARIABLE name:tmp1_subject type:kotlin.Any [val] @@ -45,8 +44,7 @@ FILE fqName: fileName:/whenByFloatingPoint.kt if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Double GET_VAR 'y: kotlin.Any declared in .testSmartCastInWhenCondition' type=kotlin.Any origin=null then: RETURN type=kotlin.Nothing from='public final fun testSmartCastInWhenCondition (x: kotlin.Double, y: kotlin.Any): kotlin.Int declared in ' - ERROR_CALL 'Unresolved reference: #' type=IrErrorType - CONST Int type=kotlin.Int value=1 + CALL 'public final fun unaryMinus (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null RETURN type=kotlin.Nothing from='public final fun testSmartCastInWhenCondition (x: kotlin.Double, y: kotlin.Any): kotlin.Int declared in ' BLOCK type=kotlin.Int origin=WHEN VAR IR_TEMPORARY_VARIABLE name:tmp2_subject type:kotlin.Double [val] @@ -59,26 +57,25 @@ FILE fqName: fileName:/whenByFloatingPoint.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CONST Int type=kotlin.Int value=1 - FUN name:testSmartCastInWhenConditionInBranch visibility:public modality:FINAL <> (x:kotlin.Any) returnType:IrErrorType + FUN name:testSmartCastInWhenConditionInBranch visibility:public modality:FINAL <> (x:kotlin.Any) returnType:kotlin.Int VALUE_PARAMETER name:x index:0 type:kotlin.Any BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun testSmartCastInWhenConditionInBranch (x: kotlin.Any): IrErrorType declared in ' - BLOCK type=IrErrorType origin=WHEN + RETURN type=kotlin.Nothing from='public final fun testSmartCastInWhenConditionInBranch (x: kotlin.Any): kotlin.Int declared in ' + BLOCK type=kotlin.Int origin=WHEN VAR IR_TEMPORARY_VARIABLE name:tmp3_subject type:kotlin.Any [val] - WHEN type=IrErrorType origin=WHEN + WHEN type=kotlin.Int origin=WHEN BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Double GET_VAR 'val tmp3_subject: kotlin.Any [val] declared in .testSmartCastInWhenConditionInBranch' type=kotlin.Any origin=null - then: ERROR_CALL 'Unresolved reference: #' type=IrErrorType - CONST Int type=kotlin.Int value=1 + then: CALL 'public final fun unaryMinus (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val tmp3_subject: kotlin.Any [val] declared in .testSmartCastInWhenConditionInBranch' type=kotlin.Any origin=null - arg1: CONST Double type=IrErrorType value=0.0 - then: CONST Int type=IrErrorType value=0 + arg1: CONST Double type=kotlin.Int value=0.0 + then: CONST Int type=kotlin.Int value=0 BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CONST Int type=IrErrorType value=1 + then: CONST Int type=kotlin.Int value=1 FUN name:testSmartCastToDifferentTypes visibility:public modality:FINAL <> (x:kotlin.Any, y:kotlin.Any) returnType:kotlin.Int VALUE_PARAMETER name:x index:0 type:kotlin.Any VALUE_PARAMETER name:y index:1 type:kotlin.Any @@ -88,15 +85,13 @@ FILE fqName: fileName:/whenByFloatingPoint.kt if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Double GET_VAR 'x: kotlin.Any declared in .testSmartCastToDifferentTypes' type=kotlin.Any origin=null then: RETURN type=kotlin.Nothing from='public final fun testSmartCastToDifferentTypes (x: kotlin.Any, y: kotlin.Any): kotlin.Int declared in ' - ERROR_CALL 'Unresolved reference: #' type=IrErrorType - CONST Int type=kotlin.Int value=1 + CALL 'public final fun unaryMinus (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null WHEN type=kotlin.Int origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Float GET_VAR 'y: kotlin.Any declared in .testSmartCastToDifferentTypes' type=kotlin.Any origin=null then: RETURN type=kotlin.Nothing from='public final fun testSmartCastToDifferentTypes (x: kotlin.Any, y: kotlin.Any): kotlin.Int declared in ' - ERROR_CALL 'Unresolved reference: #' type=IrErrorType - CONST Int type=kotlin.Int value=1 + CALL 'public final fun unaryMinus (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null RETURN type=kotlin.Nothing from='public final fun testSmartCastToDifferentTypes (x: kotlin.Any, y: kotlin.Any): kotlin.Int declared in ' BLOCK type=kotlin.Int origin=WHEN VAR IR_TEMPORARY_VARIABLE name:tmp4_subject type:kotlin.Any [val] diff --git a/compiler/testData/ir/irText/expressions/ifElseIf.fir.txt b/compiler/testData/ir/irText/expressions/ifElseIf.fir.txt index 98820fb9e73..1c097f114f5 100644 --- a/compiler/testData/ir/irText/expressions/ifElseIf.fir.txt +++ b/compiler/testData/ir/irText/expressions/ifElseIf.fir.txt @@ -11,13 +11,12 @@ FILE fqName: fileName:/ifElseIf.kt then: CONST Int type=kotlin.Int value=1 BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: WHEN type=IrErrorType origin=IF + then: WHEN type=kotlin.Int origin=IF BRANCH if: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT arg0: GET_VAR 'i: kotlin.Int declared in .test' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=0 - then: ERROR_CALL 'Unresolved reference: #' type=IrErrorType - CONST Int type=kotlin.Int value=1 + then: CALL 'public final fun unaryMinus (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CONST Int type=kotlin.Int value=0 diff --git a/compiler/testData/ir/irText/expressions/literals.fir.txt b/compiler/testData/ir/irText/expressions/literals.fir.txt index c2bb4e21455..87c9dabcdfc 100644 --- a/compiler/testData/ir/irText/expressions/literals.fir.txt +++ b/compiler/testData/ir/irText/expressions/literals.fir.txt @@ -9,15 +9,14 @@ FILE fqName: fileName:/literals.kt RETURN type=kotlin.Nothing from='public final fun (): kotlin.Int declared in ' GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test1 type:kotlin.Int visibility:public [final,static] ' type=kotlin.Int origin=null PROPERTY name:test2 visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:test2 type:IrErrorType visibility:public [final,static] + FIELD PROPERTY_BACKING_FIELD name:test2 type:kotlin.Int visibility:public [final,static] EXPRESSION_BODY - ERROR_CALL 'Unresolved reference: #' type=IrErrorType - CONST Int type=kotlin.Int value=1 - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:IrErrorType + CALL 'public final fun unaryMinus (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Int correspondingProperty: PROPERTY name:test2 visibility:public modality:FINAL [val] BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): IrErrorType declared in ' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test2 type:IrErrorType visibility:public [final,static] ' type=IrErrorType origin=null + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Int declared in ' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test2 type:kotlin.Int visibility:public [final,static] ' type=kotlin.Int origin=null PROPERTY name:test3 visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:test3 type:kotlin.Boolean visibility:public [final,static] EXPRESSION_BODY @@ -64,15 +63,14 @@ FILE fqName: fileName:/literals.kt RETURN type=kotlin.Nothing from='public final fun (): kotlin.Long declared in ' GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test7 type:kotlin.Long visibility:public [final,static] ' type=kotlin.Long origin=null PROPERTY name:test8 visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:test8 type:IrErrorType visibility:public [final,static] + FIELD PROPERTY_BACKING_FIELD name:test8 type:kotlin.Long visibility:public [final,static] EXPRESSION_BODY - ERROR_CALL 'Unresolved reference: #' type=IrErrorType - CONST Long type=kotlin.Long value=1 - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:IrErrorType + CALL 'public final fun unaryMinus (): kotlin.Long declared in kotlin.Long' type=kotlin.Long origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Long correspondingProperty: PROPERTY name:test8 visibility:public modality:FINAL [val] BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): IrErrorType declared in ' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test8 type:IrErrorType visibility:public [final,static] ' type=IrErrorType origin=null + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Long declared in ' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test8 type:kotlin.Long visibility:public [final,static] ' type=kotlin.Long origin=null PROPERTY name:test9 visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:test9 type:kotlin.Double visibility:public [final,static] EXPRESSION_BODY @@ -83,15 +81,14 @@ FILE fqName: fileName:/literals.kt RETURN type=kotlin.Nothing from='public final fun (): kotlin.Double declared in ' GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test9 type:kotlin.Double visibility:public [final,static] ' type=kotlin.Double origin=null PROPERTY name:test10 visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:test10 type:IrErrorType visibility:public [final,static] + FIELD PROPERTY_BACKING_FIELD name:test10 type:kotlin.Double visibility:public [final,static] EXPRESSION_BODY - ERROR_CALL 'Unresolved reference: #' type=IrErrorType - CONST Double type=kotlin.Double value=1.0 - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:IrErrorType + CALL 'public final fun unaryMinus (): kotlin.Double declared in kotlin.Double' type=kotlin.Double origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Double correspondingProperty: PROPERTY name:test10 visibility:public modality:FINAL [val] BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): IrErrorType declared in ' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test10 type:IrErrorType visibility:public [final,static] ' type=IrErrorType origin=null + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Double declared in ' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test10 type:kotlin.Double visibility:public [final,static] ' type=kotlin.Double origin=null PROPERTY name:test11 visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:test11 type:kotlin.Float visibility:public [final,static] EXPRESSION_BODY @@ -102,15 +99,14 @@ FILE fqName: fileName:/literals.kt RETURN type=kotlin.Nothing from='public final fun (): kotlin.Float declared in ' GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test11 type:kotlin.Float visibility:public [final,static] ' type=kotlin.Float origin=null PROPERTY name:test12 visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:test12 type:IrErrorType visibility:public [final,static] + FIELD PROPERTY_BACKING_FIELD name:test12 type:kotlin.Float visibility:public [final,static] EXPRESSION_BODY - ERROR_CALL 'Unresolved reference: #' type=IrErrorType - CONST Float type=kotlin.Float value=1.0 - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:IrErrorType + CALL 'public final fun unaryMinus (): kotlin.Float declared in kotlin.Float' type=kotlin.Float origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Float correspondingProperty: PROPERTY name:test12 visibility:public modality:FINAL [val] BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): IrErrorType declared in ' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test12 type:IrErrorType visibility:public [final,static] ' type=IrErrorType origin=null + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Float declared in ' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test12 type:kotlin.Float visibility:public [final,static] ' type=kotlin.Float origin=null PROPERTY name:test13 visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:test13 type:kotlin.Char visibility:public [final,static] EXPRESSION_BODY diff --git a/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.fir.txt b/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.fir.txt index c8b949d5a5f..7d153b7ccd1 100644 --- a/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.fir.txt +++ b/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.fir.txt @@ -62,8 +62,7 @@ FILE fqName: fileName:/primitivesImplicitConversions.kt VAR name:test3 type:kotlin.Long? [val] CONST Int type=kotlin.Long? value=42 VAR name:test4 type:kotlin.Long? [val] - ERROR_CALL 'Unresolved reference: #' type=IrErrorType - CONST Int type=kotlin.Int value=1 + CALL 'public final fun unaryMinus (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null VAR name:test5 type:kotlin.Long? [val] CALL 'public final fun unaryMinus (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null VAR name:test6 type:kotlin.Short? [val] diff --git a/compiler/testData/ir/irText/expressions/simpleUnaryOperators.fir.txt b/compiler/testData/ir/irText/expressions/simpleUnaryOperators.fir.txt index f7512de4111..dce9dbbb1ef 100644 --- a/compiler/testData/ir/irText/expressions/simpleUnaryOperators.fir.txt +++ b/compiler/testData/ir/irText/expressions/simpleUnaryOperators.fir.txt @@ -1,34 +1,28 @@ FILE fqName: fileName:/simpleUnaryOperators.kt - FUN name:test1 visibility:public modality:FINAL <> (x:kotlin.Int) returnType:IrErrorType + FUN name:test1 visibility:public modality:FINAL <> (x:kotlin.Int) returnType:kotlin.Int VALUE_PARAMETER name:x index:0 type:kotlin.Int BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun test1 (x: kotlin.Int): IrErrorType declared in ' - ERROR_CALL 'Unresolved reference: #' type=IrErrorType - GET_VAR 'x: kotlin.Int declared in .test1' type=kotlin.Int origin=null - FUN name:test2 visibility:public modality:FINAL <> () returnType:IrErrorType + RETURN type=kotlin.Nothing from='public final fun test1 (x: kotlin.Int): kotlin.Int declared in ' + CALL 'public final fun unaryMinus (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.Int BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun test2 (): IrErrorType declared in ' - ERROR_CALL 'Unresolved reference: #' type=IrErrorType - CONST Int type=kotlin.Int value=42 - FUN name:test3 visibility:public modality:FINAL <> (x:kotlin.Int) returnType:IrErrorType + RETURN type=kotlin.Nothing from='public final fun test2 (): kotlin.Int declared in ' + CALL 'public final fun unaryMinus (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + FUN name:test3 visibility:public modality:FINAL <> (x:kotlin.Int) returnType:kotlin.Int VALUE_PARAMETER name:x index:0 type:kotlin.Int BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun test3 (x: kotlin.Int): IrErrorType declared in ' - ERROR_CALL 'Unresolved reference: #' type=IrErrorType - GET_VAR 'x: kotlin.Int declared in .test3' type=kotlin.Int origin=null - FUN name:test4 visibility:public modality:FINAL <> () returnType:IrErrorType + RETURN type=kotlin.Nothing from='public final fun test3 (x: kotlin.Int): kotlin.Int declared in ' + CALL 'public final fun unaryPlus (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + FUN name:test4 visibility:public modality:FINAL <> () returnType:kotlin.Int BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun test4 (): IrErrorType declared in ' - ERROR_CALL 'Unresolved reference: #' type=IrErrorType - CONST Int type=kotlin.Int value=42 - FUN name:test5 visibility:public modality:FINAL <> (x:kotlin.Boolean) returnType:IrErrorType + RETURN type=kotlin.Nothing from='public final fun test4 (): kotlin.Int declared in ' + CALL 'public final fun unaryPlus (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + FUN name:test5 visibility:public modality:FINAL <> (x:kotlin.Boolean) returnType:kotlin.Boolean VALUE_PARAMETER name:x index:0 type:kotlin.Boolean BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun test5 (x: kotlin.Boolean): IrErrorType declared in ' - ERROR_CALL 'Unresolved reference: #' type=IrErrorType - GET_VAR 'x: kotlin.Boolean declared in .test5' type=kotlin.Boolean origin=null - FUN name:test6 visibility:public modality:FINAL <> () returnType:IrErrorType + RETURN type=kotlin.Nothing from='public final fun test5 (x: kotlin.Boolean): kotlin.Boolean declared in ' + CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=null + FUN name:test6 visibility:public modality:FINAL <> () returnType:kotlin.Boolean BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun test6 (): IrErrorType declared in ' - ERROR_CALL 'Unresolved reference: #' type=IrErrorType - CONST Boolean type=kotlin.Boolean value=true + RETURN type=kotlin.Nothing from='public final fun test6 (): kotlin.Boolean declared in ' + CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=null diff --git a/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.fir.txt b/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.fir.txt index bfdda98628b..5868c0e3a8f 100644 --- a/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.fir.txt +++ b/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.fir.txt @@ -33,5 +33,4 @@ FILE fqName: fileName:/whenWithSubjectVariable.kt then: CONST Int type=kotlin.Int value=4 BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: ERROR_CALL 'Unresolved reference: #' type=IrErrorType - CONST Int type=kotlin.Int value=1 + then: CALL 'public final fun unaryMinus (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null diff --git a/idea/testData/fir/multiModule/basicWithPrimitiveJava/jvm/jvm.txt b/idea/testData/fir/multiModule/basicWithPrimitiveJava/jvm/jvm.txt index 500c8815d29..05fa8b5f3a4 100644 --- a/idea/testData/fir/multiModule/basicWithPrimitiveJava/jvm/jvm.txt +++ b/idea/testData/fir/multiModule/basicWithPrimitiveJava/jvm/jvm.txt @@ -6,8 +6,8 @@ FILE: jvm.kt public final fun test(): R|kotlin/Unit| { lval res1: R|kotlin/Boolean| = R|/Some.foo|(Int(1)) - lval res2: R|kotlin/Boolean| = R|/Some.foo|(#(Int(1))) - lval res3: R|kotlin/Array>| = R|/Some.bar|(R|kotlin/intArrayOf|(Int(0), Int(2), #(Int(2)))) + lval res2: R|kotlin/Boolean| = R|/Some.foo|(Int(1).R|kotlin/Int.unaryMinus|()) + lval res3: R|kotlin/Array>| = R|/Some.bar|(R|kotlin/intArrayOf|(Int(0), Int(2), Int(2).R|kotlin/Int.unaryMinus|())) } }