Add IR text tests fixating the state of KT-65341

This commit is contained in:
Denis.Zharkov
2024-01-29 14:58:48 +01:00
committed by Space Team
parent 64902e615e
commit 3ba8256b8d
16 changed files with 292 additions and 0 deletions
@@ -1994,6 +1994,12 @@ public class FirLightTreeJvmIrTextTestGenerated extends AbstractFirLightTreeJvmI
runTest("compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt");
}
@Test
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
runTest("compiler/testData/ir/irText/expressions/posptonedPCLACallInsideStringInterpolation.kt");
}
@Test
@TestMetadata("primitiveComparisons.kt")
public void testPrimitiveComparisons() throws Exception {
@@ -1994,6 +1994,12 @@ public class FirPsiJvmIrTextTestGenerated extends AbstractFirPsiJvmIrTextTest {
runTest("compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt");
}
@Test
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
runTest("compiler/testData/ir/irText/expressions/posptonedPCLACallInsideStringInterpolation.kt");
}
@Test
@TestMetadata("primitiveComparisons.kt")
public void testPrimitiveComparisons() throws Exception {
@@ -0,0 +1,54 @@
FILE fqName:<root> fileName:/posptonedPCLACallInsideStringInterpolation.kt
CLASS CLASS name:Controller modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Controller<K of <root>.Controller>
TYPE_PARAMETER name:K index:0 variance: superTypes:[kotlin.Any?] reified:false
CONSTRUCTOR visibility:public <> () returnType:<root>.Controller<K of <root>.Controller> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Controller modality:FINAL visibility:public superTypes:[kotlin.Any]'
FUN name:yield visibility:public modality:FINAL <> ($this:<root>.Controller<K of <root>.Controller>, k:K of <root>.Controller) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.Controller<K of <root>.Controller>
VALUE_PARAMETER name:k index:0 type:K of <root>.Controller
BLOCK_BODY
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 <T> (lambda:@[ExtensionFunctionType] kotlin.Function1<<root>.Controller<T of <root>.generate>, kotlin.Unit>) returnType:kotlin.Unit
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
VALUE_PARAMETER name:lambda index:0 type:@[ExtensionFunctionType] kotlin.Function1<<root>.Controller<T of <root>.generate>, kotlin.Unit>
BLOCK_BODY
FUN name:id visibility:public modality:FINAL <E> (e:E of <root>.id) returnType:E of <root>.id
TYPE_PARAMETER name:E index:0 variance: superTypes:[kotlin.Any?] reified:false
VALUE_PARAMETER name:e index:0 type:E of <root>.id
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun id <E> (e: E of <root>.id): E of <root>.id declared in <root>'
GET_VAR 'e: E of <root>.id declared in <root>.id' type=E of <root>.id origin=null
FUN name:bar visibility:public modality:FINAL <> (s:kotlin.String) returnType:kotlin.Unit
VALUE_PARAMETER name:s index:0 type:kotlin.String
BLOCK_BODY
FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
CALL 'public final fun generate <T> (lambda: @[ExtensionFunctionType] kotlin.Function1<<root>.Controller<T of <root>.generate>, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
<T>: kotlin.String
lambda: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<<root>.Controller<kotlin.String>, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.Controller<kotlin.String>) returnType:kotlin.Unit
$receiver: VALUE_PARAMETER name:$this$generate type:<root>.Controller<kotlin.String>
BLOCK_BODY
CALL 'public final fun bar (s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
s: STRING_CONCATENATION type=kotlin.String
CALL 'public final fun id <E> (e: E of <root>.id): E of <root>.id declared in <root>' type=E of <root>.id origin=null
<E>: IrErrorType(null)
e: GET_VAR '$this$generate: <root>.Controller<kotlin.String> declared in <root>.foo.<anonymous>' type=<root>.Controller<kotlin.String> origin=null
CALL 'public final fun yield (k: K of <root>.Controller): kotlin.Unit declared in <root>.Controller' type=kotlin.Unit origin=null
$this: GET_VAR '$this$generate: <root>.Controller<kotlin.String> declared in <root>.foo.<anonymous>' type=<root>.Controller<kotlin.String> origin=null
k: CONST String type=kotlin.String value=""
@@ -0,0 +1,29 @@
class Controller<K : Any?> {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
fun yield(k: K) {
}
}
fun <T : Any?> generate(lambda: @ExtensionFunctionType Function1<Controller<T>, Unit>) {
}
fun <E : Any?> id(e: E): E {
return e
}
fun bar(s: String) {
}
fun foo() {
generate<String>(lambda = local fun Controller<String>.<anonymous>() {
bar(s = id<ErrorType>(e = $this$generate))
$this$generate.yield(k = "")
}
)
}
@@ -0,0 +1,54 @@
FILE fqName:<root> fileName:/posptonedPCLACallInsideStringInterpolation.kt
CLASS CLASS name:Controller modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Controller<K of <root>.Controller>
TYPE_PARAMETER name:K index:0 variance: superTypes:[kotlin.Any?] reified:false
CONSTRUCTOR visibility:public <> () returnType:<root>.Controller<K of <root>.Controller> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Controller modality:FINAL visibility:public superTypes:[kotlin.Any]'
FUN name:yield visibility:public modality:FINAL <> ($this:<root>.Controller<K of <root>.Controller>, k:K of <root>.Controller) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.Controller<K of <root>.Controller>
VALUE_PARAMETER name:k index:0 type:K of <root>.Controller
BLOCK_BODY
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 <T> (lambda:@[ExtensionFunctionType] kotlin.Function1<<root>.Controller<T of <root>.generate>, kotlin.Unit>) returnType:kotlin.Unit
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
VALUE_PARAMETER name:lambda index:0 type:@[ExtensionFunctionType] kotlin.Function1<<root>.Controller<T of <root>.generate>, kotlin.Unit>
BLOCK_BODY
FUN name:id visibility:public modality:FINAL <E> (e:E of <root>.id) returnType:E of <root>.id
TYPE_PARAMETER name:E index:0 variance: superTypes:[kotlin.Any?] reified:false
VALUE_PARAMETER name:e index:0 type:E of <root>.id
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun id <E> (e: E of <root>.id): E of <root>.id declared in <root>'
GET_VAR 'e: E of <root>.id declared in <root>.id' type=E of <root>.id origin=null
FUN name:bar visibility:public modality:FINAL <> (s:kotlin.String) returnType:kotlin.Unit
VALUE_PARAMETER name:s index:0 type:kotlin.String
BLOCK_BODY
FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
CALL 'public final fun generate <T> (lambda: @[ExtensionFunctionType] kotlin.Function1<<root>.Controller<T of <root>.generate>, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
<T>: kotlin.String
lambda: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<<root>.Controller<kotlin.String>, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.Controller<kotlin.String>) returnType:kotlin.Unit
$receiver: VALUE_PARAMETER name:$this$generate type:<root>.Controller<kotlin.String>
BLOCK_BODY
CALL 'public final fun bar (s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
s: STRING_CONCATENATION type=kotlin.String
CALL 'public final fun id <E> (e: E of <root>.id): E of <root>.id declared in <root>' type=<root>.Controller<kotlin.String> origin=null
<E>: <root>.Controller<kotlin.String>
e: GET_VAR '$this$generate: <root>.Controller<kotlin.String> declared in <root>.foo.<anonymous>' type=<root>.Controller<kotlin.String> origin=null
CALL 'public final fun yield (k: K of <root>.Controller): kotlin.Unit declared in <root>.Controller' type=kotlin.Unit origin=null
$this: GET_VAR '$this$generate: <root>.Controller<kotlin.String> declared in <root>.foo.<anonymous>' type=<root>.Controller<kotlin.String> origin=null
k: CONST String type=kotlin.String value=""
@@ -0,0 +1,22 @@
// ISSUE: KT-65341
class Controller<K> {
fun yield(k: K) {}
}
fun <T> generate(lambda: Controller<T>.() -> Unit) {}
fun <E> id(e: E): E = e
// Regular function irrelevant to PCLA
fun bar(s: String) {}
fun foo() {
generate {
// `bar(..)` itself is a regular function that should not be postponed
// But its argument is a string interpolation that contains a postponed call `id(this)`
// And by our current rule, the whole call needs to be postponed, too
bar("${id(this)}")
yield("")
}
}
@@ -0,0 +1,29 @@
class Controller<K : Any?> {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
fun yield(k: K) {
}
}
fun <T : Any?> generate(lambda: @ExtensionFunctionType Function1<Controller<T>, Unit>) {
}
fun <E : Any?> id(e: E): E {
return e
}
fun bar(s: String) {
}
fun foo() {
generate<String>(lambda = local fun Controller<String>.<anonymous>() {
bar(s = id<Controller<String>>(e = $this$generate))
$this$generate.yield(k = "")
}
)
}
@@ -0,0 +1,45 @@
// CHECK:
// Mangled name: Controller
// Public signature: /Controller|null[0]
class Controller<K : Any?> {
// CHECK:
// Mangled name: Controller#<init>(){}
// Public signature: /Controller.<init>|-5645683436151566731[0]
// Public signature debug description: <init>(){}
constructor() /* primary */
// CHECK:
// Mangled name: Controller#yield(1:0){}
// Public signature: /Controller.yield|3567278141085588417[0]
// Public signature debug description: yield(1:0){}
fun yield(k: K): Unit
}
// CHECK:
// Mangled name: #bar(kotlin.String){}
// Public signature: /bar|5132770888056479978[0]
// Public signature debug description: bar(kotlin.String){}
fun bar(s: String): Unit
// CHECK:
// Mangled name: #foo(){}
// Public signature: /foo|-1041209573719867811[0]
// Public signature debug description: foo(){}
fun foo(): Unit
// CHECK:
// Mangled name: #generate(kotlin.Function1<Controller<0:0>,kotlin.Unit>){0§<kotlin.Any?>}
// Public signature: /generate|2751630141511127019[0]
// Public signature debug description: generate(kotlin.Function1<Controller<0:0>,kotlin.Unit>){0§<kotlin.Any?>}
fun <T : Any?> generate(lambda: @ExtensionFunctionType Function1<Controller<T>, Unit>): Unit
// CHECK JVM_IR:
// Mangled name: #id(0:0){0§<kotlin.Any?>}0:0
// Public signature: /id|-6791396263062521506[0]
// Public signature debug description: id(0:0){0§<kotlin.Any?>}0:0
// CHECK JS_IR NATIVE:
// Mangled name: #id(0:0){0§<kotlin.Any?>}
// Public signature: /id|9187295668833355463[0]
// Public signature debug description: id(0:0){0§<kotlin.Any?>}
fun <E : Any?> id(e: E): E
@@ -1994,6 +1994,12 @@ public class ClassicJvmIrTextTestGenerated extends AbstractClassicJvmIrTextTest
runTest("compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt");
}
@Test
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
runTest("compiler/testData/ir/irText/expressions/posptonedPCLACallInsideStringInterpolation.kt");
}
@Test
@TestMetadata("primitiveComparisons.kt")
public void testPrimitiveComparisons() throws Exception {
@@ -1579,6 +1579,11 @@ public class KlibIrTextTestCaseGenerated extends AbstractKlibIrTextTestCase {
runTest("compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt");
}
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
runTest("compiler/testData/ir/irText/expressions/posptonedPCLACallInsideStringInterpolation.kt");
}
@TestMetadata("primitiveComparisons.kt")
public void testPrimitiveComparisons() throws Exception {
runTest("compiler/testData/ir/irText/expressions/primitiveComparisons.kt");
@@ -1760,6 +1760,12 @@ public class FirLightTreeJsIrTextTestGenerated extends AbstractFirLightTreeJsIrT
runTest("compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt");
}
@Test
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
runTest("compiler/testData/ir/irText/expressions/posptonedPCLACallInsideStringInterpolation.kt");
}
@Test
@TestMetadata("primitiveComparisons.kt")
public void testPrimitiveComparisons() throws Exception {
@@ -1760,6 +1760,12 @@ public class FirPsiJsIrTextTestGenerated extends AbstractFirPsiJsIrTextTest {
runTest("compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt");
}
@Test
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
runTest("compiler/testData/ir/irText/expressions/posptonedPCLACallInsideStringInterpolation.kt");
}
@Test
@TestMetadata("primitiveComparisons.kt")
public void testPrimitiveComparisons() throws Exception {
@@ -1760,6 +1760,12 @@ public class ClassicJsIrTextTestGenerated extends AbstractClassicJsIrTextTest {
runTest("compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt");
}
@Test
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
runTest("compiler/testData/ir/irText/expressions/posptonedPCLACallInsideStringInterpolation.kt");
}
@Test
@TestMetadata("primitiveComparisons.kt")
public void testPrimitiveComparisons() throws Exception {
@@ -1760,6 +1760,12 @@ public class ClassicNativeIrTextTestGenerated extends AbstractClassicNativeIrTex
runTest("compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt");
}
@Test
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
runTest("compiler/testData/ir/irText/expressions/posptonedPCLACallInsideStringInterpolation.kt");
}
@Test
@TestMetadata("primitiveComparisons.kt")
public void testPrimitiveComparisons() throws Exception {
@@ -1760,6 +1760,12 @@ public class FirLightTreeNativeIrTextTestGenerated extends AbstractFirLightTreeN
runTest("compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt");
}
@Test
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
runTest("compiler/testData/ir/irText/expressions/posptonedPCLACallInsideStringInterpolation.kt");
}
@Test
@TestMetadata("primitiveComparisons.kt")
public void testPrimitiveComparisons() throws Exception {
@@ -1760,6 +1760,12 @@ public class FirPsiNativeIrTextTestGenerated extends AbstractFirPsiNativeIrTextT
runTest("compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt");
}
@Test
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
runTest("compiler/testData/ir/irText/expressions/posptonedPCLACallInsideStringInterpolation.kt");
}
@Test
@TestMetadata("primitiveComparisons.kt")
public void testPrimitiveComparisons() throws Exception {