[JS IR BE] Unmute inlineClasses tests

This commit is contained in:
Svyatoslav Kuzmich
2018-12-04 18:26:54 +03:00
parent befc371f6a
commit c92a6f9ca2
14 changed files with 164 additions and 7 deletions
@@ -1,5 +1,4 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JVM
interface I<T> {
@@ -1,5 +1,4 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JVM
interface I<T> {
@@ -1,5 +1,4 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JVM
interface I<T> {
@@ -0,0 +1,20 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
inline class IC(val x: String)
interface I<T> {
fun foo(): T
}
interface II: I<IC>
class A : I<IC> {
override fun foo() = IC("O")
}
class B : II {
override fun foo() = IC("K")
}
fun box() = A().foo().x + B().foo().x
@@ -0,0 +1,49 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
inline class IC(val x: Int)
interface I<T> {
fun foo(t: T): T
}
interface I2: I<IC>
open class A<T> {
fun foo(t: T): T =
if (t is IC)
IC(20 + t.x) as T
else
t
}
open class B: A<IC>()
class C: I2, B()
fun box(): String {
val ic = IC(10)
val i: I<IC> = C()
val i2: I2 = C()
val a: A<IC> = C()
val b: B = C()
val c: C = C()
val fooI = i.foo(ic).x
if (fooI != 30) return "Fail I"
// Test calling abstract fake override methods
// with signature specialized by inline class
val fooI2 = i2.foo(ic).x
if (fooI2 != 30) return "Fail I2"
val fooA = a.foo(ic).x
if (fooA != 30) return "Fail A"
val fooB = b.foo(ic).x
if (fooB != 30) return "Fail B"
val resC = c.foo(ic).x
if (resC != 30) return "Fail C"
return "OK"
}
@@ -0,0 +1,33 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
inline class IC(val x: Int)
abstract class A<T> {
var t: T? = null
final fun foo(): T = t!!
}
class B: A<IC>()
interface I {
fun foo(): IC
}
class B2: A<IC>(), I
fun box(): String {
val b = B()
b.t = IC(10)
if (b.foo() != IC(10)) return "Fail 1"
val b2 = B2()
b2.t = IC(10)
if (b2.foo() != IC(10)) return "Fail 2"
val b2i: I = b2
if (b2i.foo() != IC(10)) return "Fail 3"
return "OK"
}
@@ -1,5 +1,5 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR, JS_IR
// IGNORE_BACKEND: JVM_IR
interface IFoo<T : IFoo<T>> {
fun T.foo(): String = bar()
@@ -1,5 +1,5 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR, JS_IR
// IGNORE_BACKEND: JVM_IR
interface IFoo<T : IFoo<T>> {
fun foo(t: T): String = t.bar()
@@ -1,6 +1,5 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS_IR
// WITH_RUNTIME
inline class Ucn(private val i: UInt)
@@ -11803,6 +11803,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/inlineClasses/boxUnboxOfInlineClassForCapturedVars.kt");
}
@TestMetadata("bridgeForFunctionReturningInlineClass.kt")
public void testBridgeForFunctionReturningInlineClass() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/bridgeForFunctionReturningInlineClass.kt");
}
@TestMetadata("bridgeGenerationWithInlineClassOverAny.kt")
public void testBridgeGenerationWithInlineClassOverAny() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/bridgeGenerationWithInlineClassOverAny.kt");
@@ -11848,6 +11853,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingAfterAssertionOperator.kt");
}
@TestMetadata("checkBoxingForComplexClassHierarchy.kt")
public void testCheckBoxingForComplexClassHierarchy() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingForComplexClassHierarchy.kt");
}
@TestMetadata("checkBoxingForNonLocalAndLabeledReturns.kt")
public void testCheckBoxingForNonLocalAndLabeledReturns() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingForNonLocalAndLabeledReturns.kt");
@@ -11868,6 +11878,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingOnLocalVariableAssignments.kt");
}
@TestMetadata("checkBoxingUnboxingForInheritedTypeSpecializedFunctions.kt")
public void testCheckBoxingUnboxingForInheritedTypeSpecializedFunctions() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingUnboxingForInheritedTypeSpecializedFunctions.kt");
}
@TestMetadata("checkCallingMembersInsideInlineClass.kt")
public void testCheckCallingMembersInsideInlineClass() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/checkCallingMembersInsideInlineClass.kt");
@@ -11808,6 +11808,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/inlineClasses/boxUnboxOfInlineClassForCapturedVars.kt");
}
@TestMetadata("bridgeForFunctionReturningInlineClass.kt")
public void testBridgeForFunctionReturningInlineClass() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/bridgeForFunctionReturningInlineClass.kt");
}
@TestMetadata("bridgeGenerationWithInlineClassOverAny.kt")
public void testBridgeGenerationWithInlineClassOverAny() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/bridgeGenerationWithInlineClassOverAny.kt");
@@ -11853,6 +11858,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingAfterAssertionOperator.kt");
}
@TestMetadata("checkBoxingForComplexClassHierarchy.kt")
public void testCheckBoxingForComplexClassHierarchy() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingForComplexClassHierarchy.kt");
}
@TestMetadata("checkBoxingForNonLocalAndLabeledReturns.kt")
public void testCheckBoxingForNonLocalAndLabeledReturns() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingForNonLocalAndLabeledReturns.kt");
@@ -11873,6 +11883,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingOnLocalVariableAssignments.kt");
}
@TestMetadata("checkBoxingUnboxingForInheritedTypeSpecializedFunctions.kt")
public void testCheckBoxingUnboxingForInheritedTypeSpecializedFunctions() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingUnboxingForInheritedTypeSpecializedFunctions.kt");
}
@TestMetadata("checkCallingMembersInsideInlineClass.kt")
public void testCheckCallingMembersInsideInlineClass() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/checkCallingMembersInsideInlineClass.kt");
@@ -9453,6 +9453,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/inlineClasses/boxUnboxOfInlineClassForCapturedVars.kt");
}
@TestMetadata("bridgeForFunctionReturningInlineClass.kt")
public void testBridgeForFunctionReturningInlineClass() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/bridgeForFunctionReturningInlineClass.kt");
}
@TestMetadata("bridgeGenerationWithInlineClassOverAny.kt")
public void testBridgeGenerationWithInlineClassOverAny() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/bridgeGenerationWithInlineClassOverAny.kt");
@@ -9488,6 +9493,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingAfterAssertionOperator.kt");
}
@TestMetadata("checkBoxingForComplexClassHierarchy.kt")
public void testCheckBoxingForComplexClassHierarchy() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingForComplexClassHierarchy.kt");
}
@TestMetadata("checkBoxingForNonLocalAndLabeledReturns.kt")
public void testCheckBoxingForNonLocalAndLabeledReturns() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingForNonLocalAndLabeledReturns.kt");
@@ -9508,6 +9518,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingOnLocalVariableAssignments.kt");
}
@TestMetadata("checkBoxingUnboxingForInheritedTypeSpecializedFunctions.kt")
public void testCheckBoxingUnboxingForInheritedTypeSpecializedFunctions() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingUnboxingForInheritedTypeSpecializedFunctions.kt");
}
@TestMetadata("checkCallingMembersInsideInlineClass.kt")
public void testCheckCallingMembersInsideInlineClass() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/checkCallingMembersInsideInlineClass.kt");
@@ -10503,6 +10503,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/inlineClasses/boxUnboxOfInlineClassForCapturedVars.kt");
}
@TestMetadata("bridgeForFunctionReturningInlineClass.kt")
public void testBridgeForFunctionReturningInlineClass() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/bridgeForFunctionReturningInlineClass.kt");
}
@TestMetadata("bridgeGenerationWithInlineClassOverAny.kt")
public void testBridgeGenerationWithInlineClassOverAny() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/bridgeGenerationWithInlineClassOverAny.kt");
@@ -10538,6 +10543,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingAfterAssertionOperator.kt");
}
@TestMetadata("checkBoxingForComplexClassHierarchy.kt")
public void testCheckBoxingForComplexClassHierarchy() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingForComplexClassHierarchy.kt");
}
@TestMetadata("checkBoxingForNonLocalAndLabeledReturns.kt")
public void testCheckBoxingForNonLocalAndLabeledReturns() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingForNonLocalAndLabeledReturns.kt");
@@ -10558,6 +10568,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingOnLocalVariableAssignments.kt");
}
@TestMetadata("checkBoxingUnboxingForInheritedTypeSpecializedFunctions.kt")
public void testCheckBoxingUnboxingForInheritedTypeSpecializedFunctions() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/checkBoxingUnboxingForInheritedTypeSpecializedFunctions.kt");
}
@TestMetadata("checkCallingMembersInsideInlineClass.kt")
public void testCheckCallingMembersInsideInlineClass() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/checkCallingMembersInsideInlineClass.kt");
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JS_IR
// EXPECTED_REACHABLE_NODES: 1304
external open class A {
open fun f(x: Int): String = definedExternally