[IR] Add test describes case from KT-48912

It actually doesn't check behaviour because we don't have proper infra
for that but explains a bit a problem for further investigations.
This commit is contained in:
Roman Artemev
2021-09-30 12:33:29 +03:00
committed by TeamCityServer
parent 8496729597
commit 1d39b37c90
9 changed files with 102 additions and 0 deletions
@@ -23123,6 +23123,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ir/serializationRegressions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("anonFakeOverride.kt")
public void testAnonFakeOverride() throws Exception {
runTest("compiler/testData/codegen/box/ir/serializationRegressions/anonFakeOverride.kt");
}
@Test
@TestMetadata("deepGenericDelegatedProperty.kt")
public void testDeepGenericDelegatedProperty() throws Exception {
@@ -0,0 +1,59 @@
// KJS_WITH_FULL_RUNTIME
// WITH_RUNTIME
// extracted case from KT-48912
// MODULE: libxxxxx
// FILE: l1.kt
package com.soywiz.korag.shader
open class Operand
open class Variable : Operand()
class Program {
class Stm(val o: Operand)
open class Visitor<E>(val default: E) {
open fun visit(stm: Stm?) {
if (stm?.o is Operand) visit(stm.o)
}
open fun visit(o: Operand): E {
if (o is Uniform) visit(o)
return default
}
open fun visit(operand: Uniform): E = default
}
}
open class Uniform(val result: String): Variable()
open class Shader(val stm: Program.Stm?) {
// Here for object.visit(Program.Stm?) FO were 2 different mangles
// 1.5.31: <anonymous>#static(kotlin.collections.LinkedHashSet<com.soywiz.korag.shader.Uniform>){}visit(com.soywiz.korag.shader.Program.Stm?){}
// 1.6.0+: {}uniforms<anonymous>#static(kotlin.collections.LinkedHashSet<com.soywiz.korag.shader.Uniform>){}visit(com.soywiz.korag.shader.Program.Stm?){}
// So fix is to make sure those mangles are identical.
val uniforms = LinkedHashSet<Uniform>().also { out ->
object : Program.Visitor<Unit>(Unit) {
override fun visit(uniform: Uniform) {
out.add(uniform)
}
}.visit(stm)
}.toSet()
}
// MODULE: main(libxxxxx)
// FILE: l2.kt
import com.soywiz.korag.shader.*
class D : Shader(Program.Stm((Uniform("OK"))))
fun foo(): Shader = D()
fun box(): String {
return foo().uniforms.first().result
}
@@ -22991,6 +22991,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ir/serializationRegressions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@Test
@TestMetadata("anonFakeOverride.kt")
public void testAnonFakeOverride() throws Exception {
runTest("compiler/testData/codegen/box/ir/serializationRegressions/anonFakeOverride.kt");
}
@Test
@TestMetadata("deepGenericDelegatedProperty.kt")
public void testDeepGenericDelegatedProperty() throws Exception {
@@ -23123,6 +23123,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ir/serializationRegressions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("anonFakeOverride.kt")
public void testAnonFakeOverride() throws Exception {
runTest("compiler/testData/codegen/box/ir/serializationRegressions/anonFakeOverride.kt");
}
@Test
@TestMetadata("deepGenericDelegatedProperty.kt")
public void testDeepGenericDelegatedProperty() throws Exception {
@@ -19288,6 +19288,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ir/serializationRegressions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@TestMetadata("anonFakeOverride.kt")
public void testAnonFakeOverride() throws Exception {
runTest("compiler/testData/codegen/box/ir/serializationRegressions/anonFakeOverride.kt");
}
@TestMetadata("deepGenericDelegatedProperty.kt")
public void testDeepGenericDelegatedProperty() throws Exception {
runTest("compiler/testData/codegen/box/ir/serializationRegressions/deepGenericDelegatedProperty.kt");
@@ -16382,6 +16382,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ir/serializationRegressions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
}
@TestMetadata("anonFakeOverride.kt")
public void testAnonFakeOverride() throws Exception {
runTest("compiler/testData/codegen/box/ir/serializationRegressions/anonFakeOverride.kt");
}
@TestMetadata("deepGenericDelegatedProperty.kt")
public void testDeepGenericDelegatedProperty() throws Exception {
runTest("compiler/testData/codegen/box/ir/serializationRegressions/deepGenericDelegatedProperty.kt");
@@ -15788,6 +15788,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ir/serializationRegressions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@TestMetadata("anonFakeOverride.kt")
public void testAnonFakeOverride() throws Exception {
runTest("compiler/testData/codegen/box/ir/serializationRegressions/anonFakeOverride.kt");
}
@TestMetadata("deepGenericDelegatedProperty.kt")
public void testDeepGenericDelegatedProperty() throws Exception {
runTest("compiler/testData/codegen/box/ir/serializationRegressions/deepGenericDelegatedProperty.kt");
@@ -15818,6 +15818,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ir/serializationRegressions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
}
@TestMetadata("anonFakeOverride.kt")
public void testAnonFakeOverride() throws Exception {
runTest("compiler/testData/codegen/box/ir/serializationRegressions/anonFakeOverride.kt");
}
@TestMetadata("deepGenericDelegatedProperty.kt")
public void testDeepGenericDelegatedProperty() throws Exception {
runTest("compiler/testData/codegen/box/ir/serializationRegressions/deepGenericDelegatedProperty.kt");
@@ -12567,6 +12567,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ir/serializationRegressions"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
}
@TestMetadata("anonFakeOverride.kt")
public void testAnonFakeOverride() throws Exception {
runTest("compiler/testData/codegen/box/ir/serializationRegressions/anonFakeOverride.kt");
}
@TestMetadata("deepGenericDelegatedProperty.kt")
public void testDeepGenericDelegatedProperty() throws Exception {
runTest("compiler/testData/codegen/box/ir/serializationRegressions/deepGenericDelegatedProperty.kt");