From 1a1bb533810f7b31e5fa6dd7b3b8c94d3deb4278 Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Wed, 15 Aug 2018 14:16:46 +0300 Subject: [PATCH] Update IR text test Additional implicit coercions to unit was added --- ...lDelegatedPropertyWithSuspendOperators.txt | 32 +++---- .../expressions/catchParameterAccess.txt | 6 +- .../irText/expressions/extFunInvokeAsFun.txt | 16 ++-- .../expressions/implicitCastToNonNull.txt | 8 +- .../expressions/variableAsFunctionCall.txt | 14 +-- .../ir/irText/lambdas/nonLocalReturn.txt | 88 +++++++++++-------- 6 files changed, 94 insertions(+), 70 deletions(-) diff --git a/compiler/testData/ir/irText/declarations/localDelegatedPropertyWithSuspendOperators.txt b/compiler/testData/ir/irText/declarations/localDelegatedPropertyWithSuspendOperators.txt index f2b8bf7f11f..0d542902109 100644 --- a/compiler/testData/ir/irText/declarations/localDelegatedPropertyWithSuspendOperators.txt +++ b/compiler/testData/ir/irText/declarations/localDelegatedPropertyWithSuspendOperators.txt @@ -39,21 +39,23 @@ FILE fqName: fileName:/localDelegatedPropertyWithSuspendOperators.kt VALUE_PARAMETER name:value index:2 type:kotlin.Int flags: BLOCK_BODY RETURN type=kotlin.Nothing from='setValue(Any?, KProperty<*>, Int): Unit' - CALL 'suspendCoroutineOrReturn(crossinline (Continuation) -> Any?): Unit' type=kotlin.Unit origin=null - : kotlin.Unit - block: BLOCK type=(kotlin.coroutines.experimental.Continuation) -> kotlin.Any origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (x:kotlin.coroutines.experimental.Continuation) returnType:kotlin.Any flags: - VALUE_PARAMETER name:x index:0 type:kotlin.coroutines.experimental.Continuation flags: - BLOCK_BODY - CALL '(Int): Unit' type=kotlin.Unit origin=EQ - $this: GET_VAR 'this@A: A' type=A origin=null - : GET_VAR 'value-parameter value: Int' type=kotlin.Int origin=null - CALL 'resume(Unit): Unit' type=kotlin.Unit origin=null - $this: GET_VAR 'value-parameter x: Continuation' type=kotlin.coroutines.experimental.Continuation origin=null - value: GET_OBJECT 'Unit' type=kotlin.Unit - RETURN type=kotlin.Nothing from='(Continuation): Any' - CALL '(): Any' type=kotlin.Any origin=GET_PROPERTY - FUNCTION_REFERENCE '(Continuation): Any' type=(kotlin.coroutines.experimental.Continuation) -> kotlin.Any origin=LAMBDA + 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] + CALL 'suspendCoroutineOrReturn(crossinline (Continuation) -> Any?): Unit' type=kotlin.Unit origin=null + : kotlin.Unit + block: BLOCK type=(kotlin.coroutines.experimental.Continuation) -> kotlin.Any origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (x:kotlin.coroutines.experimental.Continuation) returnType:kotlin.Any flags: + VALUE_PARAMETER name:x index:0 type:kotlin.coroutines.experimental.Continuation flags: + BLOCK_BODY + CALL '(Int): Unit' type=kotlin.Unit origin=EQ + $this: GET_VAR 'this@A: A' type=A origin=null + : GET_VAR 'value-parameter value: Int' type=kotlin.Int origin=null + CALL 'resume(Unit): Unit' type=kotlin.Unit origin=null + $this: GET_VAR 'value-parameter x: Continuation' type=kotlin.coroutines.experimental.Continuation origin=null + value: GET_OBJECT 'Unit' type=kotlin.Unit + RETURN type=kotlin.Nothing from='(Continuation): Any' + CALL '(): Any' type=kotlin.Any origin=GET_PROPERTY + FUNCTION_REFERENCE '(Continuation): Any' type=(kotlin.coroutines.experimental.Continuation) -> kotlin.Any origin=LAMBDA FUN name:provideDelegate visibility:public modality:FINAL <> ($this:A, host:kotlin.Any?, p:kotlin.Any) returnType:A flags:suspend $this: VALUE_PARAMETER name: type:A flags: VALUE_PARAMETER name:host index:0 type:kotlin.Any? flags: diff --git a/compiler/testData/ir/irText/expressions/catchParameterAccess.txt b/compiler/testData/ir/irText/expressions/catchParameterAccess.txt index a92367d08ea..e948f2ed3dd 100644 --- a/compiler/testData/ir/irText/expressions/catchParameterAccess.txt +++ b/compiler/testData/ir/irText/expressions/catchParameterAccess.txt @@ -5,8 +5,10 @@ FILE fqName: fileName:/catchParameterAccess.kt RETURN type=kotlin.Nothing from='test(() -> Unit): Unit' TRY type=kotlin.Unit try: BLOCK type=kotlin.Unit origin=null - CALL 'invoke(): Unit' type=kotlin.Unit origin=INVOKE - $this: GET_VAR 'value-parameter f: () -> Unit' type=() -> kotlin.Unit origin=VARIABLE_AS_FUNCTION + 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] + CALL 'invoke(): Unit' type=kotlin.Unit origin=INVOKE + $this: GET_VAR 'value-parameter f: () -> Unit' type=() -> kotlin.Unit origin=VARIABLE_AS_FUNCTION CATCH parameter=e: Exception /* = Exception */ VAR CATCH_PARAMETER name:e type:kotlin.Exception /* = java.lang.Exception */ flags:val BLOCK type=kotlin.Nothing origin=null diff --git a/compiler/testData/ir/irText/expressions/extFunInvokeAsFun.txt b/compiler/testData/ir/irText/expressions/extFunInvokeAsFun.txt index e9b55928999..55f1d98acc7 100644 --- a/compiler/testData/ir/irText/expressions/extFunInvokeAsFun.txt +++ b/compiler/testData/ir/irText/expressions/extFunInvokeAsFun.txt @@ -4,15 +4,19 @@ FILE fqName: fileName:/extFunInvokeAsFun.kt VALUE_PARAMETER name:block index:1 type:kotlin.Any?.() -> kotlin.Unit flags: BLOCK_BODY RETURN type=kotlin.Nothing from='with1(Any?, Any?.() -> Unit): Unit' - CALL 'invoke(Any?): Unit' type=kotlin.Unit origin=INVOKE - $this: GET_VAR 'value-parameter block: Any?.() -> Unit' type=kotlin.Any?.() -> kotlin.Unit origin=VARIABLE_AS_FUNCTION - p1: GET_VAR 'value-parameter receiver: Any?' type=kotlin.Any? origin=null + 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] + CALL 'invoke(Any?): Unit' type=kotlin.Unit origin=INVOKE + $this: GET_VAR 'value-parameter block: Any?.() -> Unit' type=kotlin.Any?.() -> kotlin.Unit origin=VARIABLE_AS_FUNCTION + p1: GET_VAR 'value-parameter receiver: Any?' type=kotlin.Any? origin=null FUN name:with2 visibility:public modality:FINAL <> (receiver:kotlin.Any?, block:kotlin.Any?.() -> kotlin.Unit) returnType:kotlin.Unit flags: VALUE_PARAMETER name:receiver index:0 type:kotlin.Any? flags: VALUE_PARAMETER name:block index:1 type:kotlin.Any?.() -> kotlin.Unit flags: BLOCK_BODY RETURN type=kotlin.Nothing from='with2(Any?, Any?.() -> Unit): Unit' - CALL 'invoke(Any?): Unit' type=kotlin.Unit origin=INVOKE - $this: GET_VAR 'value-parameter block: Any?.() -> Unit' type=kotlin.Any?.() -> kotlin.Unit origin=VARIABLE_AS_FUNCTION - p1: GET_VAR 'value-parameter receiver: Any?' type=kotlin.Any? origin=null + 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] + CALL 'invoke(Any?): Unit' type=kotlin.Unit origin=INVOKE + $this: GET_VAR 'value-parameter block: Any?.() -> Unit' type=kotlin.Any?.() -> kotlin.Unit origin=VARIABLE_AS_FUNCTION + p1: GET_VAR 'value-parameter receiver: Any?' type=kotlin.Any? origin=null diff --git a/compiler/testData/ir/irText/expressions/implicitCastToNonNull.txt b/compiler/testData/ir/irText/expressions/implicitCastToNonNull.txt index 46d27484233..53075b79f0b 100644 --- a/compiler/testData/ir/irText/expressions/implicitCastToNonNull.txt +++ b/compiler/testData/ir/irText/expressions/implicitCastToNonNull.txt @@ -74,7 +74,9 @@ FILE fqName: fileName:/implicitCastToNonNull.kt arg0: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EXCLEQ arg0: GET_VAR 'value-parameter x: T' type=T origin=null arg1: CONST Null type=kotlin.Nothing? value=null - then: CALL 'invoke(S): Unit' type=kotlin.Unit origin=INVOKE - $this: GET_VAR 'value-parameter fn: (S) -> Unit' type=(S) -> kotlin.Unit origin=VARIABLE_AS_FUNCTION - p1: GET_VAR 'value-parameter x: T' type=T origin=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] + CALL 'invoke(S): Unit' type=kotlin.Unit origin=INVOKE + $this: GET_VAR 'value-parameter fn: (S) -> Unit' type=(S) -> kotlin.Unit origin=VARIABLE_AS_FUNCTION + p1: GET_VAR 'value-parameter x: T' type=T origin=null diff --git a/compiler/testData/ir/irText/expressions/variableAsFunctionCall.txt b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.txt index 36fe17fb4bb..3f0fe8c31bf 100644 --- a/compiler/testData/ir/irText/expressions/variableAsFunctionCall.txt +++ b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.txt @@ -13,15 +13,19 @@ FILE fqName: fileName:/variableAsFunctionCall.kt VALUE_PARAMETER name:f index:0 type:() -> kotlin.Unit flags: BLOCK_BODY RETURN type=kotlin.Nothing from='test1(() -> Unit): Unit' - CALL 'invoke(): Unit' type=kotlin.Unit origin=INVOKE - $this: GET_VAR 'value-parameter f: () -> Unit' type=() -> kotlin.Unit origin=VARIABLE_AS_FUNCTION + 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] + CALL 'invoke(): Unit' type=kotlin.Unit origin=INVOKE + $this: GET_VAR 'value-parameter f: () -> Unit' type=() -> kotlin.Unit origin=VARIABLE_AS_FUNCTION FUN name:test2 visibility:public modality:FINAL <> (f:kotlin.String.() -> kotlin.Unit) returnType:kotlin.Unit flags: VALUE_PARAMETER name:f index:0 type:kotlin.String.() -> kotlin.Unit flags: BLOCK_BODY RETURN type=kotlin.Nothing from='test2(String.() -> Unit): Unit' - CALL 'invoke(String): Unit' type=kotlin.Unit origin=INVOKE - $this: GET_VAR 'value-parameter f: String.() -> Unit' type=kotlin.String.() -> kotlin.Unit origin=VARIABLE_AS_FUNCTION - p1: 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] + CALL 'invoke(String): Unit' type=kotlin.Unit origin=INVOKE + $this: GET_VAR 'value-parameter f: String.() -> Unit' type=kotlin.String.() -> kotlin.Unit origin=VARIABLE_AS_FUNCTION + p1: CONST String type=kotlin.String value=hello FUN name:test3 visibility:public modality:FINAL <> () returnType:kotlin.String flags: BLOCK_BODY RETURN type=kotlin.Nothing from='test3(): String' diff --git a/compiler/testData/ir/irText/lambdas/nonLocalReturn.txt b/compiler/testData/ir/irText/lambdas/nonLocalReturn.txt index cc9abf0541d..48a57d4657c 100644 --- a/compiler/testData/ir/irText/lambdas/nonLocalReturn.txt +++ b/compiler/testData/ir/irText/lambdas/nonLocalReturn.txt @@ -1,51 +1,61 @@ FILE fqName: fileName:/nonLocalReturn.kt FUN name:test0 visibility:public modality:FINAL <> () returnType:kotlin.Unit flags: BLOCK_BODY - CALL 'run(() -> Nothing): Nothing' type=kotlin.Nothing origin=null - : kotlin.Nothing - block: BLOCK type=() -> kotlin.Nothing origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Nothing flags: - BLOCK_BODY - RETURN type=kotlin.Nothing from='test0(): Unit' - GET_OBJECT 'Unit' type=kotlin.Unit - FUNCTION_REFERENCE '(): Nothing' type=() -> kotlin.Nothing origin=LAMBDA + 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] + CALL 'run(() -> Nothing): Nothing' type=kotlin.Nothing origin=null + : kotlin.Nothing + block: BLOCK type=() -> kotlin.Nothing origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Nothing flags: + BLOCK_BODY + RETURN type=kotlin.Nothing from='test0(): Unit' + GET_OBJECT 'Unit' type=kotlin.Unit + FUNCTION_REFERENCE '(): Nothing' type=() -> kotlin.Nothing origin=LAMBDA FUN name:test1 visibility:public modality:FINAL <> () returnType:kotlin.Unit flags: BLOCK_BODY - CALL 'run(() -> Unit): Unit' type=kotlin.Unit origin=null - : kotlin.Unit - block: BLOCK type=() -> kotlin.Unit origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit flags: - BLOCK_BODY - RETURN type=kotlin.Nothing from='(): Unit' - GET_OBJECT 'Unit' type=kotlin.Unit - FUNCTION_REFERENCE '(): Unit' type=() -> kotlin.Unit origin=LAMBDA + 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] + CALL 'run(() -> Unit): Unit' type=kotlin.Unit origin=null + : kotlin.Unit + block: BLOCK type=() -> kotlin.Unit origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit flags: + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Unit' + GET_OBJECT 'Unit' type=kotlin.Unit + FUNCTION_REFERENCE '(): Unit' type=() -> kotlin.Unit origin=LAMBDA FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.Unit flags: BLOCK_BODY - CALL 'run(() -> Unit): Unit' type=kotlin.Unit origin=null - : kotlin.Unit - block: BLOCK type=() -> kotlin.Unit origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit flags: - BLOCK_BODY - RETURN type=kotlin.Nothing from='(): Unit' - GET_OBJECT 'Unit' type=kotlin.Unit - FUNCTION_REFERENCE '(): Unit' type=() -> kotlin.Unit origin=LAMBDA + 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] + CALL 'run(() -> Unit): Unit' type=kotlin.Unit origin=null + : kotlin.Unit + block: BLOCK type=() -> kotlin.Unit origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit flags: + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Unit' + GET_OBJECT 'Unit' type=kotlin.Unit + FUNCTION_REFERENCE '(): Unit' type=() -> kotlin.Unit origin=LAMBDA FUN name:test3 visibility:public modality:FINAL <> () returnType:kotlin.Unit flags: BLOCK_BODY - CALL 'run(() -> Unit): Unit' type=kotlin.Unit origin=null - : kotlin.Unit - block: BLOCK type=() -> kotlin.Unit origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit flags: - BLOCK_BODY - RETURN type=kotlin.Nothing from='(): Unit' - CALL 'run(() -> Nothing): Nothing' type=kotlin.Nothing origin=null - : kotlin.Nothing - block: BLOCK type=() -> kotlin.Nothing origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Nothing flags: - BLOCK_BODY - RETURN type=kotlin.Nothing from='(): Unit' - GET_OBJECT 'Unit' type=kotlin.Unit - FUNCTION_REFERENCE '(): Nothing' type=() -> kotlin.Nothing origin=LAMBDA - FUNCTION_REFERENCE '(): Unit' type=() -> kotlin.Unit origin=LAMBDA + 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] + CALL 'run(() -> Unit): Unit' type=kotlin.Unit origin=null + : kotlin.Unit + block: BLOCK type=() -> kotlin.Unit origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit flags: + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Unit' + 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] + CALL 'run(() -> Nothing): Nothing' type=kotlin.Nothing origin=null + : kotlin.Nothing + block: BLOCK type=() -> kotlin.Nothing origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Nothing flags: + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Unit' + GET_OBJECT 'Unit' type=kotlin.Unit + FUNCTION_REFERENCE '(): Nothing' type=() -> kotlin.Nothing origin=LAMBDA + FUNCTION_REFERENCE '(): Unit' type=() -> kotlin.Unit origin=LAMBDA FUN name:testLrmFoo1 visibility:public modality:FINAL <> (ints:kotlin.collections.List) returnType:kotlin.Unit flags: VALUE_PARAMETER name:ints index:0 type:kotlin.collections.List flags: BLOCK_BODY