K2: Add new tests for PCLA implementation

Many of them have been found & minimized at FP tests/user projects

^KT-59791 Fixed
This commit is contained in:
Denis.Zharkov
2023-12-19 17:13:35 +01:00
committed by Space Team
parent 90feeab076
commit 7e4d9d9f64
87 changed files with 2776 additions and 60 deletions
@@ -0,0 +1,94 @@
FILE fqName:<root> fileName:/noSyntheticTypeParameterLeftAfterPCLA.kt
FUN name:box visibility:public modality:FINAL <> (b:kotlin.Boolean) returnType:kotlin.Unit
VALUE_PARAMETER name:b index:0 type:kotlin.Boolean
BLOCK_BODY
CALL 'public final fun generate <S> (g: @[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1<<root>.Controller<S of <root>.generate>, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
<S>: kotlin.Unit
g: FUN_EXPR type=@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1<<root>.Controller<kotlin.Unit>, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.Controller<kotlin.Unit>) returnType:kotlin.Unit [suspend]
$receiver: VALUE_PARAMETER name:$this$generate type:<root>.Controller<kotlin.Unit>
BLOCK_BODY
CALL 'public final fun expectIntf (intf: <root>.Intf): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
intf: BLOCK type=<root>.box.<anonymous>.<no name provided> origin=OBJECT_LITERAL
CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[<root>.Intf]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.box.<anonymous>.<no name provided>
CONSTRUCTOR visibility:public <> () returnType:<root>.box.<anonymous>.<no name provided> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[<root>.Intf]'
FUN name:foo visibility:public modality:OPEN <> ($this:<root>.box.<anonymous>.<no name provided>) returnType:kotlin.Unit
overridden:
public abstract fun foo (): kotlin.Unit declared in <root>.Intf
$this: VALUE_PARAMETER name:<this> type:<root>.box.<anonymous>.<no name provided>
BLOCK_BODY
WHEN type=kotlin.Unit origin=IF
BRANCH
if: GET_VAR 'b: kotlin.Boolean declared in <root>.box' type=kotlin.Boolean origin=null
then: BLOCK type=kotlin.Unit origin=null
CALL 'public final fun someUnit (): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: BLOCK type=kotlin.Unit origin=null
CALL 'public abstract fun yield (t: F of <root>.Controller): kotlin.Unit declared in <root>.Controller' type=kotlin.Unit origin=null
$this: GET_VAR '$this$generate: <root>.Controller<kotlin.Unit> declared in <root>.box.<anonymous>' type=<root>.Controller<kotlin.Unit> origin=null
t: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
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 declared in <root>.Intf
$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 <root>.Intf
$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 <root>.Intf
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.box.<anonymous>.<no name provided>' type=<root>.box.<anonymous>.<no name provided> origin=OBJECT_LITERAL
CALL 'public final fun someUnit (): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
FUN name:expectIntf visibility:public modality:FINAL <> (intf:<root>.Intf) returnType:kotlin.Unit
VALUE_PARAMETER name:intf index:0 type:<root>.Intf
BLOCK_BODY
FUN name:someUnit visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
CLASS INTERFACE name:Intf modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Intf
FUN name:foo visibility:public modality:ABSTRACT <> ($this:<root>.Intf) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.Intf
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 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
CLASS INTERFACE name:Controller modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Controller<F of <root>.Controller>
TYPE_PARAMETER name:F index:0 variance: superTypes:[kotlin.Any?] reified:false
FUN name:yield visibility:public modality:ABSTRACT <> ($this:<root>.Controller<F of <root>.Controller>, t:F of <root>.Controller) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.Controller<F of <root>.Controller>
VALUE_PARAMETER name:t index:0 type:F of <root>.Controller
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 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:generate visibility:public modality:FINAL <S> (g:@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1<<root>.Controller<S of <root>.generate>, kotlin.Unit>) returnType:kotlin.Unit
TYPE_PARAMETER name:S index:0 variance: superTypes:[kotlin.Any?] reified:false
VALUE_PARAMETER name:g index:0 type:@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1<<root>.Controller<S of <root>.generate>, kotlin.Unit>
BLOCK_BODY
@@ -0,0 +1,34 @@
// FIR_IDENTICAL
fun box(b: Boolean) {
generate {
expectIntf(object : Intf {
override fun foo() {
if (b) {
// Do not debounce regex toggle event.
someUnit()
}
else {
yield(Unit)
}
}
})
someUnit()
}
}
fun expectIntf(intf: Intf) {}
fun someUnit() {}
interface Intf {
fun foo()
}
interface Controller<F> {
fun yield(t: F)
}
fun <S> generate(g: suspend Controller<S>.() -> Unit) {}
@@ -0,0 +1,48 @@
fun box(b: Boolean) {
generate<Unit>(g = local suspend fun Controller<Unit>.<anonymous>() {
expectIntf(intf = { // BLOCK
local class <no name provided> : Intf {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
override fun foo() {
when {
b -> { // BLOCK
someUnit()
}
else -> { // BLOCK
$this$generate.yield(t = Unit)
}
}
}
}
<no name provided>()
})
someUnit()
}
)
}
fun expectIntf(intf: Intf) {
}
fun someUnit() {
}
interface Intf {
abstract fun foo()
}
interface Controller<F : Any?> {
abstract fun yield(t: F)
}
fun <S : Any?> generate(g: @ExtensionFunctionType SuspendFunction1<Controller<S>, Unit>) {
}
@@ -0,0 +1,47 @@
// CHECK:
// Mangled name: Controller
// Public signature: /Controller|null[0]
interface Controller<F : Any?> {
// CHECK:
// Mangled name: Controller#yield(1:0){}
// Public signature: /Controller.yield|3567278141085588417[0]
// Public signature debug description: yield(1:0){}
abstract fun yield(t: F): Unit
}
// CHECK:
// Mangled name: Intf
// Public signature: /Intf|null[0]
interface Intf {
// CHECK:
// Mangled name: Intf#foo(){}
// Public signature: /Intf.foo|-1041209573719867811[0]
// Public signature debug description: foo(){}
abstract fun foo(): Unit
}
// CHECK:
// Mangled name: #box(kotlin.Boolean){}
// Public signature: /box|3724984511501944637[0]
// Public signature debug description: box(kotlin.Boolean){}
fun box(b: Boolean): Unit
// CHECK:
// Mangled name: #expectIntf(Intf){}
// Public signature: /expectIntf|-7688726594904654744[0]
// Public signature debug description: expectIntf(Intf){}
fun expectIntf(intf: Intf): Unit
// CHECK:
// Mangled name: #generate(kotlin.coroutines.SuspendFunction1<Controller<0:0>,kotlin.Unit>){0§<kotlin.Any?>}
// Public signature: /generate|-3399873670227373031[0]
// Public signature debug description: generate(kotlin.coroutines.SuspendFunction1<Controller<0:0>,kotlin.Unit>){0§<kotlin.Any?>}
fun <S : Any?> generate(g: @ExtensionFunctionType SuspendFunction1<Controller<S>, Unit>): Unit
// CHECK:
// Mangled name: #someUnit(){}
// Public signature: /someUnit|-6636253765775113966[0]
// Public signature debug description: someUnit(){}
fun someUnit(): Unit