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,67 @@
FILE fqName:<root> fileName:/noErrorTypeAfterCaptureApproximation.kt
CLASS CLASS name:Inv1 modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Inv1<X of <root>.Inv1>
TYPE_PARAMETER name:X index:0 variance: superTypes:[kotlin.Any?] reified:false
CONSTRUCTOR visibility:public <> () returnType:<root>.Inv1<X of <root>.Inv1> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Inv1 modality:FINAL visibility:public 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 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 CLASS name:Inv2 modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Inv2<Y of <root>.Inv2>
TYPE_PARAMETER name:Y index:0 variance: superTypes:[kotlin.Any?] reified:false
CONSTRUCTOR visibility:public <> () returnType:<root>.Inv2<Y of <root>.Inv2> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Inv2 modality:FINAL visibility:public 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 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:useSelectOptions visibility:internal modality:FINAL <F> (options:<root>.Inv1<out F of <root>.useSelectOptions>) returnType:<root>.Inv1<out <root>.Inv2<F of <root>.useSelectOptions>>
TYPE_PARAMETER name:F index:0 variance: superTypes:[kotlin.Any?] reified:false
VALUE_PARAMETER name:options index:0 type:<root>.Inv1<out F of <root>.useSelectOptions>
BLOCK_BODY
RETURN type=kotlin.Nothing from='internal final fun useSelectOptions <F> (options: <root>.Inv1<out F of <root>.useSelectOptions>): <root>.Inv1<out <root>.Inv2<F of <root>.useSelectOptions>> declared in <root>'
CALL 'public final fun myRun <T> (callback: kotlin.Function0<T of <root>.myRun>): T of <root>.myRun declared in <root>' type=<root>.Inv1<out <root>.Inv2<F of <root>.useSelectOptions>> origin=null
<T>: <root>.Inv1<out <root>.Inv2<F of <root>.useSelectOptions>>
callback: FUN_EXPR type=kotlin.Function0<<root>.Inv1<out <root>.Inv2<F of <root>.useSelectOptions>>> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:<root>.Inv1<out <root>.Inv2<F of <root>.useSelectOptions>>
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): <root>.Inv1<out <root>.Inv2<F of <root>.useSelectOptions>> declared in <root>.useSelectOptions'
CALL 'private final fun getSelectOptions <G> (options: <root>.Inv1<out G of <root>.getSelectOptions>): <root>.Inv1<out <root>.Inv2<G of <root>.getSelectOptions>> declared in <root>' type=<root>.Inv1<out <root>.Inv2<F of <root>.useSelectOptions>> origin=null
<G>: F of <root>.useSelectOptions
options: GET_VAR 'options: <root>.Inv1<out F of <root>.useSelectOptions> declared in <root>.useSelectOptions' type=<root>.Inv1<out F of <root>.useSelectOptions> origin=null
FUN name:getSelectOptions visibility:private modality:FINAL <G> (options:<root>.Inv1<out G of <root>.getSelectOptions>) returnType:<root>.Inv1<out <root>.Inv2<G of <root>.getSelectOptions>>
TYPE_PARAMETER name:G index:0 variance: superTypes:[kotlin.Any?] reified:false
VALUE_PARAMETER name:options index:0 type:<root>.Inv1<out G of <root>.getSelectOptions>
BLOCK_BODY
RETURN type=kotlin.Nothing from='private final fun getSelectOptions <G> (options: <root>.Inv1<out G of <root>.getSelectOptions>): <root>.Inv1<out <root>.Inv2<G of <root>.getSelectOptions>> declared in <root>'
CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null
FUN name:myRun visibility:public modality:FINAL <T> (callback:kotlin.Function0<T of <root>.myRun>) returnType:T of <root>.myRun
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
VALUE_PARAMETER name:callback index:0 type:kotlin.Function0<T of <root>.myRun>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun myRun <T> (callback: kotlin.Function0<T of <root>.myRun>): T of <root>.myRun declared in <root>'
CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null
@@ -0,0 +1,18 @@
// FIR_IDENTICAL
class Inv1<X>
class Inv2<Y>
internal fun <F> useSelectOptions(
options: Inv1<out F>,
): Inv1<out Inv2<F>> =
myRun {
getSelectOptions(options)
}
private fun <G> getSelectOptions(
options: Inv1<out G>,
): Inv1<out Inv2<G>> = TODO()
fun <T> myRun(
callback: () -> T,
): T = TODO()
@@ -0,0 +1,32 @@
class Inv1<X : Any?> {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
}
class Inv2<Y : Any?> {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
}
internal fun <F : Any?> useSelectOptions(options: Inv1<out F>): Inv1<out Inv2<F>> {
return myRun<Inv1<out Inv2<F>>>(callback = local fun <anonymous>(): Inv1<out Inv2<F>> {
return getSelectOptions<F>(options = options)
}
)
}
private fun <G : Any?> getSelectOptions(options: Inv1<out G>): Inv1<out Inv2<G>> {
return TODO()
}
fun <T : Any?> myRun(callback: Function0<T>): T {
return TODO()
}
@@ -0,0 +1,51 @@
// CHECK:
// Mangled name: Inv1
// Public signature: /Inv1|null[0]
class Inv1<X : Any?> {
// CHECK:
// Mangled name: Inv1#<init>(){}
// Public signature: /Inv1.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
}
// CHECK:
// Mangled name: Inv2
// Public signature: /Inv2|null[0]
class Inv2<Y : Any?> {
// CHECK:
// Mangled name: Inv2#<init>(){}
// Public signature: /Inv2.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
}
// CHECK JVM_IR:
// Mangled name: #getSelectOptions(Inv1<out|0:0>){0§<kotlin.Any?>}Inv1<out|Inv2<0:0>>
// Public signature: [ File '/noErrorTypeAfterCaptureApproximation.kt' <- /getSelectOptions|-2121566878546647451[0] ]
// CHECK JS_IR NATIVE:
// Mangled name: #getSelectOptions(Inv1<out|0:0>){0§<kotlin.Any?>}
// Public signature: [ File '/noErrorTypeAfterCaptureApproximation.kt' <- /getSelectOptions|-4741332616265873823[0] ]
private fun <G : Any?> getSelectOptions(options: Inv1<out G>): Inv1<out Inv2<G>>
// CHECK JVM_IR:
// Mangled name: #myRun(kotlin.Function0<0:0>){0§<kotlin.Any?>}0:0
// Public signature: /myRun|-4555774550754215835[0]
// Public signature debug description: myRun(kotlin.Function0<0:0>){0§<kotlin.Any?>}0:0
// CHECK JS_IR NATIVE:
// Mangled name: #myRun(kotlin.Function0<0:0>){0§<kotlin.Any?>}
// Public signature: /myRun|1886570319999512118[0]
// Public signature debug description: myRun(kotlin.Function0<0:0>){0§<kotlin.Any?>}
fun <T : Any?> myRun(callback: Function0<T>): T
// CHECK JVM_IR:
// Mangled name: #useSelectOptions(Inv1<out|0:0>){0§<kotlin.Any?>}Inv1<out|Inv2<0:0>>
// Public signature: /useSelectOptions|-100409295329799165[0]
// Public signature debug description: useSelectOptions(Inv1<out|0:0>){0§<kotlin.Any?>}Inv1<out|Inv2<0:0>>
// CHECK JS_IR NATIVE:
// Mangled name: #useSelectOptions(Inv1<out|0:0>){0§<kotlin.Any?>}
// Public signature: /useSelectOptions|3229886791495085251[0]
// Public signature debug description: useSelectOptions(Inv1<out|0:0>){0§<kotlin.Any?>}
internal fun <F : Any?> useSelectOptions(options: Inv1<out F>): Inv1<out Inv2<F>>