K2: add a black box test to confirm KT-53718 now works properly (JVM IR only)

Related to: KT-57584, KT-58110
This commit is contained in:
Mikhail Glukhikh
2023-11-13 22:43:05 +01:00
committed by Space Team
parent 4b1368409d
commit 4d49bdb8ca
9 changed files with 81 additions and 0 deletions
@@ -17984,6 +17984,12 @@ public class LLFirBlackBoxCodegenBasedTestGenerated extends AbstractLLFirBlackBo
runTest("compiler/testData/codegen/box/extensionClasses/multiple.kt");
}
@Test
@TestMetadata("noRedeclaration.kt")
public void testNoRedeclaration() throws Exception {
runTest("compiler/testData/codegen/box/extensionClasses/noRedeclaration.kt");
}
@Test
@TestMetadata("propertyWithContext.kt")
public void testPropertyWithContext() throws Exception {
@@ -17984,6 +17984,12 @@ public class LLFirReversedBlackBoxCodegenBasedTestGenerated extends AbstractLLFi
runTest("compiler/testData/codegen/box/extensionClasses/multiple.kt");
}
@Test
@TestMetadata("noRedeclaration.kt")
public void testNoRedeclaration() throws Exception {
runTest("compiler/testData/codegen/box/extensionClasses/noRedeclaration.kt");
}
@Test
@TestMetadata("propertyWithContext.kt")
public void testPropertyWithContext() throws Exception {
@@ -17913,6 +17913,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
runTest("compiler/testData/codegen/box/extensionClasses/multiple.kt");
}
@Test
@TestMetadata("noRedeclaration.kt")
public void testNoRedeclaration() throws Exception {
runTest("compiler/testData/codegen/box/extensionClasses/noRedeclaration.kt");
}
@Test
@TestMetadata("propertyWithContext.kt")
public void testPropertyWithContext() throws Exception {
@@ -17913,6 +17913,12 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated
runTest("compiler/testData/codegen/box/extensionClasses/multiple.kt");
}
@Test
@TestMetadata("noRedeclaration.kt")
public void testNoRedeclaration() throws Exception {
runTest("compiler/testData/codegen/box/extensionClasses/noRedeclaration.kt");
}
@Test
@TestMetadata("propertyWithContext.kt")
public void testPropertyWithContext() throws Exception {
@@ -17913,6 +17913,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
runTest("compiler/testData/codegen/box/extensionClasses/multiple.kt");
}
@Test
@TestMetadata("noRedeclaration.kt")
public void testNoRedeclaration() throws Exception {
runTest("compiler/testData/codegen/box/extensionClasses/noRedeclaration.kt");
}
@Test
@TestMetadata("propertyWithContext.kt")
public void testPropertyWithContext() throws Exception {
@@ -0,0 +1,34 @@
// TARGET_BACKEND: JVM_IR
// Does not pass on other backends for various reasons, e.g.
// - FIR/WASM: IR declaration with signature "/x|{}x[0]" found in SymbolTable and not found in declaration storage
// - IR/JS: IrPropertyPublicSymbolImpl for /x|{}x[0] is already bound: PROPERTY name:x visibility:public modality:FINAL [val]
// - Old BE: Couldn't inline method call: with(A()) { ... }
// - See also: KT-57584, KT-58110
// LANGUAGE: +ContextReceivers
// ISSUE: KT-53718
class A
context(A)
val x: Int
get() = 1
val x: Int
get() = 2
context(A)
fun foo() = 3
fun foo() = 4
fun box(): String {
if (x != 2) return "x = $x"
if (foo() != 4) return "foo() = ${foo()}"
with(A()) {
if (x != 1) return "context x = $x"
if (foo() != 3) return "context foo() = ${foo()}"
}
return "OK"
}
@@ -17913,6 +17913,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/extensionClasses/multiple.kt");
}
@Test
@TestMetadata("noRedeclaration.kt")
public void testNoRedeclaration() throws Exception {
runTest("compiler/testData/codegen/box/extensionClasses/noRedeclaration.kt");
}
@Test
@TestMetadata("propertyWithContext.kt")
public void testPropertyWithContext() throws Exception {
@@ -17913,6 +17913,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
runTest("compiler/testData/codegen/box/extensionClasses/multiple.kt");
}
@Test
@TestMetadata("noRedeclaration.kt")
public void testNoRedeclaration() throws Exception {
runTest("compiler/testData/codegen/box/extensionClasses/noRedeclaration.kt");
}
@Test
@TestMetadata("propertyWithContext.kt")
public void testPropertyWithContext() throws Exception {
@@ -14854,6 +14854,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/extensionClasses/multiple.kt");
}
@TestMetadata("noRedeclaration.kt")
public void testNoRedeclaration() throws Exception {
runTest("compiler/testData/codegen/box/extensionClasses/noRedeclaration.kt");
}
@TestMetadata("propertyWithContext.kt")
public void testPropertyWithContext() throws Exception {
runTest("compiler/testData/codegen/box/extensionClasses/propertyWithContext.kt");