PSI2IR KT-51036 fix lambda return value generation

This commit is contained in:
Dmitry Petrov
2022-01-31 12:51:53 +03:00
committed by Space
parent 02d731255c
commit beb4cf3d99
19 changed files with 222 additions and 9 deletions
@@ -20,7 +20,8 @@ FILE fqName:<root> fileName:/badBreakContinue.kt
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Nothing
BLOCK_BODY
ERROR_EXPR 'Loop not found for break expression: break@L1' type=kotlin.Nothing
ERROR_EXPR 'Loop not found for continue expression: continue@L1' type=kotlin.Nothing
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Nothing declared in <root>.test3'
ERROR_EXPR 'Loop not found for continue expression: continue@L1' type=kotlin.Nothing
FUN name:test4 visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
WHILE label=null origin=WHILE_LOOP
@@ -14,7 +14,7 @@ fun test3() {
L1@ while (true) { // BLOCK
val lambda: Function0<Nothing> = local fun <anonymous>(): Nothing {
error("") /* ErrorExpression */
error("") /* ErrorExpression */
return error("") /* ErrorExpression */
}
}
@@ -0,0 +1,59 @@
FILE fqName:<root> fileName:/kt51036.kt
CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
CONSTRUCTOR visibility:public <> () returnType:<root>.A [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]'
CLASS OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A.Companion
CONSTRUCTOR visibility:private <> () returnType:<root>.A.Companion [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlin.Any]'
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:invoke visibility:public modality:FINAL <> ($this:<root>.A, $receiver:kotlin.String) returnType:kotlin.Unit [operator]
$this: VALUE_PARAMETER name:<this> type:<root>.A
$receiver: VALUE_PARAMETER name:<this> type:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun invoke (): kotlin.Unit [operator] declared in <root>.A'
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
FUN name:close visibility:public modality:FINAL <> ($this:<root>.A) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.A
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun close (): kotlin.Unit declared in <root>.A'
CALL 'public final fun invoke (): kotlin.Unit [operator] declared in <root>.A' type=kotlin.Unit origin=null
$this: GET_VAR '<this>: <root>.A declared in <root>.A.close' type=<root>.A origin=null
$receiver: CALL 'public final fun synchronized <R> (lock: kotlin.Any, block: kotlin.Function0<R of kotlin.StandardKt.synchronized>): R of kotlin.StandardKt.synchronized [inline] declared in kotlin.StandardKt' type=kotlin.String origin=null
<R>: kotlin.String
lock: GET_VAR '<this>: <root>.A declared in <root>.A.close' type=<root>.A origin=null
block: FUN_EXPR type=kotlin.Function0<kotlin.String> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in <root>.A.close'
CONST String type=kotlin.String value="Abc"
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
+59
View File
@@ -0,0 +1,59 @@
FILE fqName:<root> fileName:/kt51036.kt
CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
CONSTRUCTOR visibility:public <> () returnType:<root>.A [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]'
CLASS OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A.Companion
CONSTRUCTOR visibility:private <> () returnType:<root>.A.Companion [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlin.Any]'
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:invoke visibility:public modality:FINAL <> ($this:<root>.A, $receiver:kotlin.String) returnType:kotlin.Unit [operator]
$this: VALUE_PARAMETER name:<this> type:<root>.A
$receiver: VALUE_PARAMETER name:<this> type:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun invoke (): kotlin.Unit [operator] declared in <root>.A'
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
FUN name:close visibility:public modality:FINAL <> ($this:<root>.A) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.A
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun close (): kotlin.Unit declared in <root>.A'
CALL 'public final fun invoke (): kotlin.Unit [operator] declared in <root>.A' type=kotlin.Unit origin=INVOKE
$this: GET_VAR '<this>: <root>.A declared in <root>.A.close' type=<root>.A origin=null
$receiver: CALL 'public final fun synchronized <R> (lock: kotlin.Any, block: kotlin.Function0<R of kotlin.StandardKt.synchronized>): R of kotlin.StandardKt.synchronized [inline] declared in kotlin.StandardKt' type=kotlin.String origin=null
<R>: kotlin.String
lock: GET_VAR '<this>: <root>.A declared in <root>.A.close' type=<root>.A origin=null
block: FUN_EXPR type=kotlin.Function0<kotlin.String> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in <root>.A.close'
CONST String type=kotlin.String value="Abc"
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
+8
View File
@@ -0,0 +1,8 @@
// WITH_STDLIB
// SKIP_KT_DUMP
class A {
companion object;
operator fun String.invoke() = Unit
fun close() = synchronized(this) { "Abc" }()
}