Remove duplicate tests from JS compiler test set. Merge chages to common compiler tests

This commit is contained in:
Svyatoslav Kuzmich
2019-02-18 15:40:23 +03:00
parent a736756ceb
commit beb5f73a2b
80 changed files with 56 additions and 2086 deletions
@@ -1,8 +1,18 @@
fun run(arg1: A, funRef:A.() -> String): String {
return arg1.funRef()
}
class A
fun A.foo() = "OK"
fun box(): String {
val x = A::foo
return x(A())
var r = x(A())
if (r != "OK") return r
r = run(A(), A::foo)
if (r != "OK") return r
return "OK"
}
@@ -1,8 +1,16 @@
fun run(arg1: A, arg2: String, funRef:A.(String) -> String): String {
return arg1.funRef(arg2)
}
class A
fun A.foo(result: String) = result
fun box(): String {
val x = A::foo
return x(A(), "OK")
var r = x(A(), "OK")
if (r != "OK") return r
r = run(A(), "OK", A::foo)
return "OK"
}
@@ -1,3 +1,7 @@
fun run(arg1: A, arg2: String, funRef:A.(String) -> Unit): Unit {
return arg1.funRef(arg2)
}
class A {
var result = "Fail"
}
@@ -10,5 +14,12 @@ fun box(): String {
val a = A()
val x = A::foo
x(a, "OK")
return a.result
if (a.result != "OK") return a.result
val a1 = A()
run(a1, "OK", A::foo)
if (a1.result != "OK") return a1.result
return "OK"
}
@@ -1,3 +1,7 @@
fun <T> run(arg1: T, arg2: T, funRef:(T,T) -> T): T {
return funRef(arg1, arg2)
}
fun foo(o: Int, k: Int) = o + k
class A {
@@ -7,5 +11,9 @@ class A {
fun box(): String {
val result = A().bar()
if (result != 333) return "Fail $result"
var r = run(111, 222, ::foo)
if (result != 333) return "Fail $result"
return "OK"
}
@@ -1,3 +1,7 @@
fun <T> run(arg1: T, arg2: T, funRef:(T,T) -> T): T {
return funRef(arg1, arg2)
}
fun foo(o: Int, k: Int) = o + k
class A
@@ -7,5 +11,9 @@ fun A.bar() = (::foo)(111, 222)
fun box(): String {
val result = A().bar()
if (result != 333) return "Fail $result"
var r = run(111, 222, ::foo)
if (result != 333) return "Fail $result"
return "OK"
}
@@ -2,5 +2,12 @@ fun foo() = "OK"
fun box(): String {
val x = ::foo
return x()
var r = x()
if (r != "OK") return r
r = run(::foo)
if (r != "OK") return r
return "OK"
}
@@ -95,20 +95,10 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
}
@TestMetadata("abstractClassMember.kt")
public void testAbstractClassMember() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/abstractClassMember.kt");
}
public void testAllFilesPresentInFunction() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/callableReference/function"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS, true);
}
@TestMetadata("classMemberAndExtension.kt")
public void testClassMemberAndExtension() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/classMemberAndExtension.kt");
}
@TestMetadata("classMemberAndNonExtensionCompatibility.kt")
public void testClassMemberAndNonExtensionCompatibility() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/classMemberAndNonExtensionCompatibility.kt");
@@ -119,56 +109,11 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
runTest("js/js.translator/testData/box/callableReference/function/classMemberDirectCache.kt");
}
@TestMetadata("classMemberFromClass.kt")
public void testClassMemberFromClass() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/classMemberFromClass.kt");
}
@TestMetadata("classMemberFromExtension.kt")
public void testClassMemberFromExtension() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/classMemberFromExtension.kt");
}
@TestMetadata("classMemberFromTopLevelStringNoArgs.kt")
public void testClassMemberFromTopLevelStringNoArgs() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/classMemberFromTopLevelStringNoArgs.kt");
}
@TestMetadata("classMemberFromTopLevelStringOneStringArg.kt")
public void testClassMemberFromTopLevelStringOneStringArg() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/classMemberFromTopLevelStringOneStringArg.kt");
}
@TestMetadata("classMemberFromTopLevelUnitNoArgs.kt")
public void testClassMemberFromTopLevelUnitNoArgs() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/classMemberFromTopLevelUnitNoArgs.kt");
}
@TestMetadata("classMemberFromTopLevelUnitOneStringArg.kt")
public void testClassMemberFromTopLevelUnitOneStringArg() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/classMemberFromTopLevelUnitOneStringArg.kt");
}
@TestMetadata("classMemberOverridden.kt")
public void testClassMemberOverridden() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/classMemberOverridden.kt");
}
@TestMetadata("closureWithSideEffect.kt")
public void testClosureWithSideEffect() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/closureWithSideEffect.kt");
}
@TestMetadata("constructorFromTopLevelNoArgs.kt")
public void testConstructorFromTopLevelNoArgs() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/constructorFromTopLevelNoArgs.kt");
}
@TestMetadata("constructorFromTopLevelOneStringArg.kt")
public void testConstructorFromTopLevelOneStringArg() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/constructorFromTopLevelOneStringArg.kt");
}
@TestMetadata("constructorsWithArgs.kt")
public void testConstructorsWithArgs() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/constructorsWithArgs.kt");
@@ -179,56 +124,11 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
runTest("js/js.translator/testData/box/callableReference/function/constructorsWithArgsSimple.kt");
}
@TestMetadata("extension.kt")
public void testExtension() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/extension.kt");
}
@TestMetadata("extensionFromClass.kt")
public void testExtensionFromClass() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/extensionFromClass.kt");
}
@TestMetadata("extensionFromExtension.kt")
public void testExtensionFromExtension() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/extensionFromExtension.kt");
}
@TestMetadata("extensionFromTopLevel.kt")
public void testExtensionFromTopLevel() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/extensionFromTopLevel.kt");
}
@TestMetadata("extensionFromTopLevelStringNoArgs.kt")
public void testExtensionFromTopLevelStringNoArgs() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/extensionFromTopLevelStringNoArgs.kt");
}
@TestMetadata("extensionFromTopLevelStringOneStringArg.kt")
public void testExtensionFromTopLevelStringOneStringArg() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/extensionFromTopLevelStringOneStringArg.kt");
}
@TestMetadata("extensionFromTopLevelUnitNoArgs.kt")
public void testExtensionFromTopLevelUnitNoArgs() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/extensionFromTopLevelUnitNoArgs.kt");
}
@TestMetadata("extensionFromTopLevelUnitOneStringArg.kt")
public void testExtensionFromTopLevelUnitOneStringArg() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/extensionFromTopLevelUnitOneStringArg.kt");
}
@TestMetadata("extensionToPrimitive.kt")
public void testExtensionToPrimitive() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/extensionToPrimitive.kt");
}
@TestMetadata("extensionWithClosure.kt")
public void testExtensionWithClosure() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/extensionWithClosure.kt");
}
@TestMetadata("functionReferenceName.kt")
public void testFunctionReferenceName() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/functionReferenceName.kt");
@@ -239,60 +139,15 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
runTest("js/js.translator/testData/box/callableReference/function/localAndTopLevelExtensions.kt");
}
@TestMetadata("localLocal.kt")
public void testLocalLocal() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/localLocal.kt");
}
@TestMetadata("recursiveClosure.kt")
public void testRecursiveClosure() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/recursiveClosure.kt");
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/simple.kt");
}
@TestMetadata("simpleClosure.kt")
public void testSimpleClosure() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/simpleClosure.kt");
}
@TestMetadata("simpleWithArg.kt")
public void testSimpleWithArg() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/simpleWithArg.kt");
}
@TestMetadata("stringNativeExtension.kt")
public void testStringNativeExtension() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/stringNativeExtension.kt");
}
@TestMetadata("topLevelFromClass.kt")
public void testTopLevelFromClass() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/topLevelFromClass.kt");
}
@TestMetadata("topLevelFromExtension.kt")
public void testTopLevelFromExtension() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/topLevelFromExtension.kt");
}
@TestMetadata("topLevelFromTopLevelStringNoArgs.kt")
public void testTopLevelFromTopLevelStringNoArgs() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/topLevelFromTopLevelStringNoArgs.kt");
}
@TestMetadata("topLevelFromTopLevelWithArg.kt")
public void testTopLevelFromTopLevelWithArg() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/topLevelFromTopLevelWithArg.kt");
}
@TestMetadata("unitWithSideEffect.kt")
public void testUnitWithSideEffect() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/unitWithSideEffect.kt");
}
}
@TestMetadata("js/js.translator/testData/box/callableReference/property")
@@ -303,75 +158,20 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
}
@TestMetadata("accessViaSubclass.kt")
public void testAccessViaSubclass() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/accessViaSubclass.kt");
}
public void testAllFilesPresentInProperty() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/callableReference/property"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS, true);
}
@TestMetadata("delegated.kt")
public void testDelegated() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/delegated.kt");
}
@TestMetadata("delegatedMutable.kt")
public void testDelegatedMutable() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/delegatedMutable.kt");
}
@TestMetadata("extensionProperty.kt")
public void testExtensionProperty() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/extensionProperty.kt");
}
@TestMetadata("kClassInstanceIsInitializedFirst.kt")
public void testKClassInstanceIsInitializedFirst() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/kClassInstanceIsInitializedFirst.kt");
}
@TestMetadata("memberProperty.kt")
public void testMemberProperty() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/memberProperty.kt");
}
@TestMetadata("overriddenInSubclass.kt")
public void testOverriddenInSubclass() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/overriddenInSubclass.kt");
}
@TestMetadata("simpleExtension.kt")
public void testSimpleExtension() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/simpleExtension.kt");
}
@TestMetadata("simpleMember.kt")
public void testSimpleMember() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/simpleMember.kt");
}
@TestMetadata("simpleMutableExtension.kt")
public void testSimpleMutableExtension() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/simpleMutableExtension.kt");
}
@TestMetadata("simpleMutableMember.kt")
public void testSimpleMutableMember() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/simpleMutableMember.kt");
}
@TestMetadata("simpleMutableTopLevel.kt")
public void testSimpleMutableTopLevel() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/simpleMutableTopLevel.kt");
}
@TestMetadata("simpleTopLevel.kt")
public void testSimpleTopLevel() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/simpleTopLevel.kt");
}
@TestMetadata("topLevelVar.kt")
public void testTopLevelVar() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/topLevelVar.kt");
@@ -1313,21 +1113,6 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
runTest("js/js.translator/testData/box/delegation/complexDelegation.kt");
}
@TestMetadata("delegation2.kt")
public void testDelegation2() throws Exception {
runTest("js/js.translator/testData/box/delegation/delegation2.kt");
}
@TestMetadata("delegation3.kt")
public void testDelegation3() throws Exception {
runTest("js/js.translator/testData/box/delegation/delegation3.kt");
}
@TestMetadata("delegation4.kt")
public void testDelegation4() throws Exception {
runTest("js/js.translator/testData/box/delegation/delegation4.kt");
}
@TestMetadata("delegationByArg.kt")
public void testDelegationByArg() throws Exception {
runTest("js/js.translator/testData/box/delegation/delegationByArg.kt");
@@ -1393,16 +1178,6 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
runTest("js/js.translator/testData/box/delegation/delegationExtensionPropertyDelegated.kt");
}
@TestMetadata("delegationGenericArg.kt")
public void testDelegationGenericArg() throws Exception {
runTest("js/js.translator/testData/box/delegation/delegationGenericArg.kt");
}
@TestMetadata("delegationMethodsWithArgs.kt")
public void testDelegationMethodsWithArgs() throws Exception {
runTest("js/js.translator/testData/box/delegation/delegationMethodsWithArgs.kt");
}
@TestMetadata("jsNamePropertyDelegation.kt")
public void testJsNamePropertyDelegation() throws Exception {
runTest("js/js.translator/testData/box/delegation/jsNamePropertyDelegation.kt");
@@ -1622,145 +1397,10 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
runTest("js/js.translator/testData/box/examples/basicmethod.kt");
}
@TestMetadata("basicproperty.kt")
public void testBasicproperty() throws Exception {
runTest("js/js.translator/testData/box/examples/basicproperty.kt");
}
@TestMetadata("classObject.kt")
public void testClassObject() throws Exception {
runTest("js/js.translator/testData/box/examples/classObject.kt");
}
@TestMetadata("closureWithParameter.kt")
public void testClosureWithParameter() throws Exception {
runTest("js/js.translator/testData/box/examples/closureWithParameter.kt");
}
@TestMetadata("closureWithParameterAndBoxing.kt")
public void testClosureWithParameterAndBoxing() throws Exception {
runTest("js/js.translator/testData/box/examples/closureWithParameterAndBoxing.kt");
}
@TestMetadata("doubleEnclosedLocalVariable.kt")
public void testDoubleEnclosedLocalVariable() throws Exception {
runTest("js/js.translator/testData/box/examples/doubleEnclosedLocalVariable.kt");
}
@TestMetadata("enclosed.kt")
public void testEnclosed() throws Exception {
runTest("js/js.translator/testData/box/examples/enclosed.kt");
}
@TestMetadata("enclosingLocalVariable.kt")
public void testEnclosingLocalVariable() throws Exception {
runTest("js/js.translator/testData/box/examples/enclosingLocalVariable.kt");
}
@TestMetadata("extensionClosure.kt")
public void testExtensionClosure() throws Exception {
runTest("js/js.translator/testData/box/examples/extensionClosure.kt");
}
@TestMetadata("funDelegation.kt")
public void testFunDelegation() throws Exception {
runTest("js/js.translator/testData/box/examples/funDelegation.kt");
}
@TestMetadata("incrementProperty.kt")
public void testIncrementProperty() throws Exception {
runTest("js/js.translator/testData/box/examples/incrementProperty.kt");
}
@TestMetadata("inheritance.kt")
public void testInheritance() throws Exception {
runTest("js/js.translator/testData/box/examples/inheritance.kt");
}
@TestMetadata("inheritedInnerClass.kt")
public void testInheritedInnerClass() throws Exception {
runTest("js/js.translator/testData/box/examples/inheritedInnerClass.kt");
}
@TestMetadata("inheritedMethod.kt")
public void testInheritedMethod() throws Exception {
runTest("js/js.translator/testData/box/examples/inheritedMethod.kt");
}
@TestMetadata("initializerBlock.kt")
public void testInitializerBlock() throws Exception {
runTest("js/js.translator/testData/box/examples/initializerBlock.kt");
}
@TestMetadata("initializerBlockDImpl.kt")
public void testInitializerBlockDImpl() throws Exception {
runTest("js/js.translator/testData/box/examples/initializerBlockDImpl.kt");
}
@TestMetadata("innerClass.kt")
public void testInnerClass() throws Exception {
runTest("js/js.translator/testData/box/examples/innerClass.kt");
}
@TestMetadata("kt242.kt")
public void testKt242() throws Exception {
runTest("js/js.translator/testData/box/examples/kt242.kt");
}
@TestMetadata("newInstanceDefaultConstructor.kt")
public void testNewInstanceDefaultConstructor() throws Exception {
runTest("js/js.translator/testData/box/examples/newInstanceDefaultConstructor.kt");
}
@TestMetadata("overloadBinaryOperator.kt")
public void testOverloadBinaryOperator() throws Exception {
runTest("js/js.translator/testData/box/examples/overloadBinaryOperator.kt");
}
@TestMetadata("overloadPlusAssignReturn.kt")
public void testOverloadPlusAssignReturn() throws Exception {
runTest("js/js.translator/testData/box/examples/overloadPlusAssignReturn.kt");
}
@TestMetadata("overloadPlusToPlusAssign.kt")
public void testOverloadPlusToPlusAssign() throws Exception {
runTest("js/js.translator/testData/box/examples/overloadPlusToPlusAssign.kt");
}
@TestMetadata("overloadUnaryOperator.kt")
public void testOverloadUnaryOperator() throws Exception {
runTest("js/js.translator/testData/box/examples/overloadUnaryOperator.kt");
}
@TestMetadata("propertyDelegation.kt")
public void testPropertyDelegation() throws Exception {
runTest("js/js.translator/testData/box/examples/propertyDelegation.kt");
}
@TestMetadata("propertyInInitializer.kt")
public void testPropertyInInitializer() throws Exception {
runTest("js/js.translator/testData/box/examples/propertyInInitializer.kt");
}
@TestMetadata("rightHandOverride.kt")
public void testRightHandOverride() throws Exception {
runTest("js/js.translator/testData/box/examples/rightHandOverride.kt");
}
@TestMetadata("simplestClosure.kt")
public void testSimplestClosure() throws Exception {
runTest("js/js.translator/testData/box/examples/simplestClosure.kt");
}
@TestMetadata("simplestClosureAndBoxing.kt")
public void testSimplestClosureAndBoxing() throws Exception {
runTest("js/js.translator/testData/box/examples/simplestClosureAndBoxing.kt");
}
@TestMetadata("traitproperty.kt")
public void testTraitproperty() throws Exception {
runTest("js/js.translator/testData/box/examples/traitproperty.kt");
}
}
@TestMetadata("js/js.translator/testData/box/expression")
@@ -95,20 +95,10 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
@TestMetadata("abstractClassMember.kt")
public void testAbstractClassMember() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/abstractClassMember.kt");
}
public void testAllFilesPresentInFunction() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/callableReference/function"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("classMemberAndExtension.kt")
public void testClassMemberAndExtension() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/classMemberAndExtension.kt");
}
@TestMetadata("classMemberAndNonExtensionCompatibility.kt")
public void testClassMemberAndNonExtensionCompatibility() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/classMemberAndNonExtensionCompatibility.kt");
@@ -119,56 +109,11 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
runTest("js/js.translator/testData/box/callableReference/function/classMemberDirectCache.kt");
}
@TestMetadata("classMemberFromClass.kt")
public void testClassMemberFromClass() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/classMemberFromClass.kt");
}
@TestMetadata("classMemberFromExtension.kt")
public void testClassMemberFromExtension() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/classMemberFromExtension.kt");
}
@TestMetadata("classMemberFromTopLevelStringNoArgs.kt")
public void testClassMemberFromTopLevelStringNoArgs() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/classMemberFromTopLevelStringNoArgs.kt");
}
@TestMetadata("classMemberFromTopLevelStringOneStringArg.kt")
public void testClassMemberFromTopLevelStringOneStringArg() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/classMemberFromTopLevelStringOneStringArg.kt");
}
@TestMetadata("classMemberFromTopLevelUnitNoArgs.kt")
public void testClassMemberFromTopLevelUnitNoArgs() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/classMemberFromTopLevelUnitNoArgs.kt");
}
@TestMetadata("classMemberFromTopLevelUnitOneStringArg.kt")
public void testClassMemberFromTopLevelUnitOneStringArg() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/classMemberFromTopLevelUnitOneStringArg.kt");
}
@TestMetadata("classMemberOverridden.kt")
public void testClassMemberOverridden() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/classMemberOverridden.kt");
}
@TestMetadata("closureWithSideEffect.kt")
public void testClosureWithSideEffect() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/closureWithSideEffect.kt");
}
@TestMetadata("constructorFromTopLevelNoArgs.kt")
public void testConstructorFromTopLevelNoArgs() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/constructorFromTopLevelNoArgs.kt");
}
@TestMetadata("constructorFromTopLevelOneStringArg.kt")
public void testConstructorFromTopLevelOneStringArg() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/constructorFromTopLevelOneStringArg.kt");
}
@TestMetadata("constructorsWithArgs.kt")
public void testConstructorsWithArgs() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/constructorsWithArgs.kt");
@@ -179,56 +124,11 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
runTest("js/js.translator/testData/box/callableReference/function/constructorsWithArgsSimple.kt");
}
@TestMetadata("extension.kt")
public void testExtension() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/extension.kt");
}
@TestMetadata("extensionFromClass.kt")
public void testExtensionFromClass() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/extensionFromClass.kt");
}
@TestMetadata("extensionFromExtension.kt")
public void testExtensionFromExtension() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/extensionFromExtension.kt");
}
@TestMetadata("extensionFromTopLevel.kt")
public void testExtensionFromTopLevel() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/extensionFromTopLevel.kt");
}
@TestMetadata("extensionFromTopLevelStringNoArgs.kt")
public void testExtensionFromTopLevelStringNoArgs() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/extensionFromTopLevelStringNoArgs.kt");
}
@TestMetadata("extensionFromTopLevelStringOneStringArg.kt")
public void testExtensionFromTopLevelStringOneStringArg() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/extensionFromTopLevelStringOneStringArg.kt");
}
@TestMetadata("extensionFromTopLevelUnitNoArgs.kt")
public void testExtensionFromTopLevelUnitNoArgs() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/extensionFromTopLevelUnitNoArgs.kt");
}
@TestMetadata("extensionFromTopLevelUnitOneStringArg.kt")
public void testExtensionFromTopLevelUnitOneStringArg() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/extensionFromTopLevelUnitOneStringArg.kt");
}
@TestMetadata("extensionToPrimitive.kt")
public void testExtensionToPrimitive() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/extensionToPrimitive.kt");
}
@TestMetadata("extensionWithClosure.kt")
public void testExtensionWithClosure() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/extensionWithClosure.kt");
}
@TestMetadata("functionReferenceName.kt")
public void testFunctionReferenceName() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/functionReferenceName.kt");
@@ -239,60 +139,15 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
runTest("js/js.translator/testData/box/callableReference/function/localAndTopLevelExtensions.kt");
}
@TestMetadata("localLocal.kt")
public void testLocalLocal() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/localLocal.kt");
}
@TestMetadata("recursiveClosure.kt")
public void testRecursiveClosure() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/recursiveClosure.kt");
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/simple.kt");
}
@TestMetadata("simpleClosure.kt")
public void testSimpleClosure() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/simpleClosure.kt");
}
@TestMetadata("simpleWithArg.kt")
public void testSimpleWithArg() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/simpleWithArg.kt");
}
@TestMetadata("stringNativeExtension.kt")
public void testStringNativeExtension() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/stringNativeExtension.kt");
}
@TestMetadata("topLevelFromClass.kt")
public void testTopLevelFromClass() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/topLevelFromClass.kt");
}
@TestMetadata("topLevelFromExtension.kt")
public void testTopLevelFromExtension() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/topLevelFromExtension.kt");
}
@TestMetadata("topLevelFromTopLevelStringNoArgs.kt")
public void testTopLevelFromTopLevelStringNoArgs() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/topLevelFromTopLevelStringNoArgs.kt");
}
@TestMetadata("topLevelFromTopLevelWithArg.kt")
public void testTopLevelFromTopLevelWithArg() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/topLevelFromTopLevelWithArg.kt");
}
@TestMetadata("unitWithSideEffect.kt")
public void testUnitWithSideEffect() throws Exception {
runTest("js/js.translator/testData/box/callableReference/function/unitWithSideEffect.kt");
}
}
@TestMetadata("js/js.translator/testData/box/callableReference/property")
@@ -303,75 +158,20 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
@TestMetadata("accessViaSubclass.kt")
public void testAccessViaSubclass() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/accessViaSubclass.kt");
}
public void testAllFilesPresentInProperty() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/callableReference/property"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("delegated.kt")
public void testDelegated() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/delegated.kt");
}
@TestMetadata("delegatedMutable.kt")
public void testDelegatedMutable() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/delegatedMutable.kt");
}
@TestMetadata("extensionProperty.kt")
public void testExtensionProperty() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/extensionProperty.kt");
}
@TestMetadata("kClassInstanceIsInitializedFirst.kt")
public void testKClassInstanceIsInitializedFirst() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/kClassInstanceIsInitializedFirst.kt");
}
@TestMetadata("memberProperty.kt")
public void testMemberProperty() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/memberProperty.kt");
}
@TestMetadata("overriddenInSubclass.kt")
public void testOverriddenInSubclass() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/overriddenInSubclass.kt");
}
@TestMetadata("simpleExtension.kt")
public void testSimpleExtension() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/simpleExtension.kt");
}
@TestMetadata("simpleMember.kt")
public void testSimpleMember() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/simpleMember.kt");
}
@TestMetadata("simpleMutableExtension.kt")
public void testSimpleMutableExtension() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/simpleMutableExtension.kt");
}
@TestMetadata("simpleMutableMember.kt")
public void testSimpleMutableMember() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/simpleMutableMember.kt");
}
@TestMetadata("simpleMutableTopLevel.kt")
public void testSimpleMutableTopLevel() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/simpleMutableTopLevel.kt");
}
@TestMetadata("simpleTopLevel.kt")
public void testSimpleTopLevel() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/simpleTopLevel.kt");
}
@TestMetadata("topLevelVar.kt")
public void testTopLevelVar() throws Exception {
runTest("js/js.translator/testData/box/callableReference/property/topLevelVar.kt");
@@ -1313,21 +1113,6 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
runTest("js/js.translator/testData/box/delegation/complexDelegation.kt");
}
@TestMetadata("delegation2.kt")
public void testDelegation2() throws Exception {
runTest("js/js.translator/testData/box/delegation/delegation2.kt");
}
@TestMetadata("delegation3.kt")
public void testDelegation3() throws Exception {
runTest("js/js.translator/testData/box/delegation/delegation3.kt");
}
@TestMetadata("delegation4.kt")
public void testDelegation4() throws Exception {
runTest("js/js.translator/testData/box/delegation/delegation4.kt");
}
@TestMetadata("delegationByArg.kt")
public void testDelegationByArg() throws Exception {
runTest("js/js.translator/testData/box/delegation/delegationByArg.kt");
@@ -1393,16 +1178,6 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
runTest("js/js.translator/testData/box/delegation/delegationExtensionPropertyDelegated.kt");
}
@TestMetadata("delegationGenericArg.kt")
public void testDelegationGenericArg() throws Exception {
runTest("js/js.translator/testData/box/delegation/delegationGenericArg.kt");
}
@TestMetadata("delegationMethodsWithArgs.kt")
public void testDelegationMethodsWithArgs() throws Exception {
runTest("js/js.translator/testData/box/delegation/delegationMethodsWithArgs.kt");
}
@TestMetadata("jsNamePropertyDelegation.kt")
public void testJsNamePropertyDelegation() throws Exception {
runTest("js/js.translator/testData/box/delegation/jsNamePropertyDelegation.kt");
@@ -1622,145 +1397,10 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
runTest("js/js.translator/testData/box/examples/basicmethod.kt");
}
@TestMetadata("basicproperty.kt")
public void testBasicproperty() throws Exception {
runTest("js/js.translator/testData/box/examples/basicproperty.kt");
}
@TestMetadata("classObject.kt")
public void testClassObject() throws Exception {
runTest("js/js.translator/testData/box/examples/classObject.kt");
}
@TestMetadata("closureWithParameter.kt")
public void testClosureWithParameter() throws Exception {
runTest("js/js.translator/testData/box/examples/closureWithParameter.kt");
}
@TestMetadata("closureWithParameterAndBoxing.kt")
public void testClosureWithParameterAndBoxing() throws Exception {
runTest("js/js.translator/testData/box/examples/closureWithParameterAndBoxing.kt");
}
@TestMetadata("doubleEnclosedLocalVariable.kt")
public void testDoubleEnclosedLocalVariable() throws Exception {
runTest("js/js.translator/testData/box/examples/doubleEnclosedLocalVariable.kt");
}
@TestMetadata("enclosed.kt")
public void testEnclosed() throws Exception {
runTest("js/js.translator/testData/box/examples/enclosed.kt");
}
@TestMetadata("enclosingLocalVariable.kt")
public void testEnclosingLocalVariable() throws Exception {
runTest("js/js.translator/testData/box/examples/enclosingLocalVariable.kt");
}
@TestMetadata("extensionClosure.kt")
public void testExtensionClosure() throws Exception {
runTest("js/js.translator/testData/box/examples/extensionClosure.kt");
}
@TestMetadata("funDelegation.kt")
public void testFunDelegation() throws Exception {
runTest("js/js.translator/testData/box/examples/funDelegation.kt");
}
@TestMetadata("incrementProperty.kt")
public void testIncrementProperty() throws Exception {
runTest("js/js.translator/testData/box/examples/incrementProperty.kt");
}
@TestMetadata("inheritance.kt")
public void testInheritance() throws Exception {
runTest("js/js.translator/testData/box/examples/inheritance.kt");
}
@TestMetadata("inheritedInnerClass.kt")
public void testInheritedInnerClass() throws Exception {
runTest("js/js.translator/testData/box/examples/inheritedInnerClass.kt");
}
@TestMetadata("inheritedMethod.kt")
public void testInheritedMethod() throws Exception {
runTest("js/js.translator/testData/box/examples/inheritedMethod.kt");
}
@TestMetadata("initializerBlock.kt")
public void testInitializerBlock() throws Exception {
runTest("js/js.translator/testData/box/examples/initializerBlock.kt");
}
@TestMetadata("initializerBlockDImpl.kt")
public void testInitializerBlockDImpl() throws Exception {
runTest("js/js.translator/testData/box/examples/initializerBlockDImpl.kt");
}
@TestMetadata("innerClass.kt")
public void testInnerClass() throws Exception {
runTest("js/js.translator/testData/box/examples/innerClass.kt");
}
@TestMetadata("kt242.kt")
public void testKt242() throws Exception {
runTest("js/js.translator/testData/box/examples/kt242.kt");
}
@TestMetadata("newInstanceDefaultConstructor.kt")
public void testNewInstanceDefaultConstructor() throws Exception {
runTest("js/js.translator/testData/box/examples/newInstanceDefaultConstructor.kt");
}
@TestMetadata("overloadBinaryOperator.kt")
public void testOverloadBinaryOperator() throws Exception {
runTest("js/js.translator/testData/box/examples/overloadBinaryOperator.kt");
}
@TestMetadata("overloadPlusAssignReturn.kt")
public void testOverloadPlusAssignReturn() throws Exception {
runTest("js/js.translator/testData/box/examples/overloadPlusAssignReturn.kt");
}
@TestMetadata("overloadPlusToPlusAssign.kt")
public void testOverloadPlusToPlusAssign() throws Exception {
runTest("js/js.translator/testData/box/examples/overloadPlusToPlusAssign.kt");
}
@TestMetadata("overloadUnaryOperator.kt")
public void testOverloadUnaryOperator() throws Exception {
runTest("js/js.translator/testData/box/examples/overloadUnaryOperator.kt");
}
@TestMetadata("propertyDelegation.kt")
public void testPropertyDelegation() throws Exception {
runTest("js/js.translator/testData/box/examples/propertyDelegation.kt");
}
@TestMetadata("propertyInInitializer.kt")
public void testPropertyInInitializer() throws Exception {
runTest("js/js.translator/testData/box/examples/propertyInInitializer.kt");
}
@TestMetadata("rightHandOverride.kt")
public void testRightHandOverride() throws Exception {
runTest("js/js.translator/testData/box/examples/rightHandOverride.kt");
}
@TestMetadata("simplestClosure.kt")
public void testSimplestClosure() throws Exception {
runTest("js/js.translator/testData/box/examples/simplestClosure.kt");
}
@TestMetadata("simplestClosureAndBoxing.kt")
public void testSimplestClosureAndBoxing() throws Exception {
runTest("js/js.translator/testData/box/examples/simplestClosureAndBoxing.kt");
}
@TestMetadata("traitproperty.kt")
public void testTraitproperty() throws Exception {
runTest("js/js.translator/testData/box/examples/traitproperty.kt");
}
}
@TestMetadata("js/js.translator/testData/box/expression")
@@ -1,13 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1291
// This test was adapted from compiler/testData/codegen/box/callableReference/function/.
package foo
abstract class A {
abstract fun foo(): String
}
class B : A() {
override fun foo() = "OK"
}
fun box(): String = (A::foo)(B())
@@ -1,26 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1286
package foo
class A {
val s = "sA"
fun memBar(other: String): String = s +":memBar:" + other
}
fun A.extBar(other: String):String = s + ":extBar:" + other
fun box():String {
fun A.locExtBar(other: String):String = s + ":locExtBar:" + other
val a = A()
var r = (A::memBar)(a, "!!")
if (r != "sA:memBar:!!") return r
r = (A::extBar)(a, "!!")
if (r != "sA:extBar:!!") return r
r = (A::locExtBar)(a, "!!")
if (r != "sA:locExtBar:!!") return r
return "OK"
}
@@ -1,15 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1285
// This test was adapted from compiler/testData/codegen/box/callableReference/function/.
package foo
class A {
fun bar(k: Int) = k
fun result() = (A::bar)(this, 111)
}
fun box(): String {
val result = A().result()
if (result != 111) return "Fail $result"
return "OK"
}
@@ -1,16 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1286
// This test was adapted from compiler/testData/codegen/box/callableReference/function/.
package foo
class A {
fun o() = 111
fun k(k: Int) = k
}
fun A.bar() = (A::o)(this) + (A::k)(this, 222)
fun box(): String {
val result = A().bar()
if (result != 333) return "Fail $result"
return "OK"
}
@@ -1,13 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1284
// This test was adapted from compiler/testData/codegen/box/callableReference/function/.
package foo
class A {
fun foo() = "OK"
}
fun box(): String {
val x = A::foo
var r = x(A())
return r
}
@@ -1,14 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1284
// This test was adapted from compiler/testData/codegen/box/callableReference/function/.
package foo
class A {
fun foo(result: String):String = result
}
fun box(): String {
val x = A::foo
var r = x(A(), "OK")
return r
}
@@ -1,18 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1284
// This test was adapted from compiler/testData/codegen/box/callableReference/function/.
package foo
class A {
var result = "Fail"
fun foo() {
result = "OK"
}
}
fun box(): String {
val a = A()
val x = A::foo
x(a)
return a.result
}
@@ -1,18 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1284
// This test was adapted from compiler/testData/codegen/box/callableReference/function/.
package foo
class A {
var result = "Fail"
fun foo(newResult: String) {
result = newResult
}
}
fun box(): String {
val a = A()
val x = A::foo
x(a, "OK")
return a.result
}
@@ -1,13 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1281
// This test was adapted from compiler/testData/codegen/box/callableReference/function/local/.
package foo
fun box(): String {
var result = "Fail"
fun changeToOK() { result = "OK" }
val ok = ::changeToOK
ok()
return result
}
@@ -1,9 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1282
// This test was adapted from compiler/testData/codegen/box/callableReference/function/.
package foo
class A {
var result = "OK"
}
fun box() = (::A)().result
@@ -1,7 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1282
// This test was adapted from compiler/testData/codegen/box/callableReference/function/.
package foo
class A(val result: String)
fun box() = (::A)("OK").result
@@ -1,10 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1283
// This test was adapted from compiler/testData/codegen/box/callableReference/function/local/.
package foo
class A
fun box(): String {
fun A.foo() = "OK"
return (A::foo)(A())
}
@@ -1,11 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1285
// This test was adapted from compiler/testData/codegen/box/callableReference/function/.
package foo
class A {
fun result() = (A::bar)(this, "OK")
}
fun A.bar(x: String) = x
fun box() = A().result()
@@ -1,11 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1284
// This test was adapted from compiler/testData/codegen/box/callableReference/function/.
package foo
class A
fun A.foo() = (A::bar)(this, "OK")
fun A.bar(x: String) = x
fun box() = A().foo()
@@ -1,22 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1284
// This test was adapted from compiler/testData/codegen/box/callableReference/function/.
package foo
fun run(arg1: A, funRef:A.() -> String): String {
return arg1.funRef()
}
class A
fun A.foo() = "OK"
fun box(): String {
val x = A::foo
var r = x(A())
if (r != "OK") return r
r = run(A(), A::foo)
if (r != "OK") return r
return "OK"
}
@@ -1,20 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1284
// This test was adapted from compiler/testData/codegen/box/callableReference/function/.
package foo
fun run(arg1: A, arg2: String, funRef:A.(String) -> String): String {
return arg1.funRef(arg2)
}
class A
fun A.foo(result: String) = result
fun box(): String {
val x = A::foo
var r = x(A(), "OK")
if (r != "OK") return r
r = run(A(), "OK", A::foo)
return "OK"
}
@@ -1,19 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1283
// This test was adapted from compiler/testData/codegen/box/callableReference/function/.
package foo
class A {
var result = "Fail"
}
fun A.foo() {
result = "OK"
}
fun box(): String {
val a = A()
val x = A::foo
x(a)
return a.result
}
@@ -1,32 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1283
// This test was adapted from compiler/testData/codegen/box/callableReference/function/.
package foo
fun run(arg1: A, arg2: String, funRef:A.(String) -> Unit): Unit {
return arg1.funRef(arg2)
}
class A {
var result = "Fail"
}
fun A.foo(newResult: String) {
result = newResult
}
fun box(): String {
val a = A()
val x = A::foo
x(a, "OK")
if (a.result != "OK") return a.result
// TODO: uncomment when KT-13312 gets fixed
/*
val a1 = A()
run(a1, "OK", A::foo)
if (a1.result != "OK) return a1.result
*/
return "OK"
}
@@ -1,8 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1281
// This test was adapted from compiler/testData/codegen/box/callableReference/function/local/.
package foo
fun box(): String {
fun Int.is42With(that: Int) = this + 2 * that == 42
return if ((Int::is42With)(16, 13)) "OK" else "Fail"
}
@@ -1,15 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1283
// This test was adapted from compiler/testData/codegen/box/callableReference/function/local/.
package foo
class A
fun box(): String {
var result = "Fail"
fun A.ext() { result = "OK" }
val f = A::ext
f(A())
return result
}
@@ -1,14 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1282
// This test was adapted from compiler/testData/codegen/box/callableReference/function/local/.
package foo
fun box(): String {
fun foo(): String {
fun bar() = "OK"
val ref = ::bar
return ref()
}
val ref = ::foo
return ref()
}
@@ -1,11 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1283
// This test was adapted from compiler/testData/codegen/box/callableReference/function/local/.
package foo
fun foo(until: Int): String {
fun bar(x: Int): String =
if (x == until) "OK" else bar(x + 1)
return (::bar)(0)
}
fun box() = foo(10)
@@ -1,8 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1281
// This test was adapted from compiler/testData/codegen/box/callableReference/function/local/.
package foo
fun box(): String {
fun foo() = "OK"
return (::foo)()
}
@@ -1,11 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1281
// This test was adapted from compiler/testData/codegen/box/callableReference/function/local/.
package foo
fun box(): String {
val result = "OK"
fun foo() = result
return (::foo)()
}
@@ -1,8 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1281
// This test was adapted from compiler/testData/codegen/box/callableReference/function/local/.
package foo
fun box(): String {
fun foo(s: String) = s
return (::foo)("OK")
}
@@ -1,23 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1286
// This test was adapted from compiler/testData/codegen/box/callableReference/function/.
package foo
fun <T> run(arg1: T, arg2: T, funRef:(T,T) -> T): T {
return funRef(arg1, arg2)
}
fun tmp(o: Int, k: Int) = o + k
class A {
fun bar() = (::tmp)(111, 222)
}
fun box(): String {
val result = A().bar()
if (result != 333) return "Fail $result"
var r = run(111, 222, ::tmp)
if (result != 333) return "Fail $result"
return "OK"
}
@@ -1,23 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1285
// This test was adapted from compiler/testData/codegen/box/callableReference/function/.
package foo
fun <T> run(arg1: T, arg2: T, funRef:(T,T) -> T): T {
return funRef(arg1, arg2)
}
fun tmp(o: Int, k: Int) = o + k
class A
fun A.bar() = (::tmp)(111, 222)
fun box(): String {
val result = A().bar()
if (result != 333) return "Fail $result"
var r = run(111, 222, ::tmp)
if (result != 333) return "Fail $result"
return "OK"
}
@@ -1,21 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1282
// This test was adapted from compiler/testData/codegen/box/callableReference/function/.
package foo
fun run(funRef:() -> String): String {
return funRef()
}
fun bar() = "OK"
fun box(): String {
val x = ::bar
var r = x()
if (r != "OK") return r
r = run(::bar)
if (r != "OK") return r
return "OK"
}
@@ -1,19 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1282
// This test was adapted from compiler/testData/codegen/box/callableReference/function/local/.
package foo
var state = 23
fun box(): String {
fun incrementState(inc: Int) {
state += inc
}
val inc = ::incrementState
inc(12)
inc(-5)
inc(27)
inc(-15)
return if (state == 42) "OK" else "Fail $state"
}
@@ -1,13 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1293
// This test was adapted from compiler/testData/codegen/box/callableReference/property/.
package foo
abstract class Base {
val result = "OK"
}
class Derived : Base()
fun box(): String {
return (Base::result).get(Derived())
}
@@ -1,28 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1240
// This test was adapted from compiler/testData/codegen/box/callableReference/property/.
package foo
import kotlin.reflect.KProperty
object NumberDecrypter {
operator fun getValue(instance: Any?, data: KProperty<*>) = when (data.name) {
"four" -> 4
"two" -> 2
else -> throw Exception()
}
}
val four: Int by NumberDecrypter
class A {
val two: Int by NumberDecrypter
}
fun box(): String {
val x = ::four.get()
if (x != 4) return "Fail x: $x"
val a = A()
val y = A::two.get(a)
if (y != 2) return "Fail y: $y"
return "OK"
}
@@ -1,28 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1298
// This test was adapted from compiler/testData/codegen/box/callableReference/property/.
package foo
import kotlin.reflect.KProperty
object Delegate {
var value = "lol"
operator fun getValue(instance: Any?, data: KProperty<*>): String {
return value
}
operator fun setValue(instance: Any?, data: KProperty<*>, newValue: String) {
value = newValue
}
}
var result: String by Delegate
fun box(): String {
val f = ::result
if (f.get() != "lol") return "Fail 1: {$f.get()}"
Delegate.value = "rofl"
if (f.get() != "rofl") return "Fail 2: {$f.get()}"
f.set("OK")
return f.get()
}
@@ -1,17 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1290
// This test was adapted from compiler/testData/codegen/box/callableReference/property/.
package foo
import kotlin.reflect.KProperty1
class A {
companion object {
val ref: KProperty1<A, String> = A::foo
}
val foo: String = "OK"
}
fun box(): String {
return A.ref.get(A())
}
@@ -1,13 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1295
// This test was adapted from compiler/testData/codegen/box/callableReference/property/.
package foo
open class Base {
open val foo = "Base"
}
class Derived : Base() {
override val foo = "OK"
}
fun box() = (Base::foo).get(Derived())
@@ -1,16 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1285
// This test was adapted from compiler/testData/codegen/box/callableReference/property/.
package foo
val String.id: String
get() = this
fun box(): String {
val pr = String::id
if (pr.get("123") != "123") return "Fail value: ${pr.get("123")}"
if (pr.name != "id") return "Fail name: ${pr.name}"
return pr.get("OK")
}
@@ -1,13 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1286
// This test was adapted from compiler/testData/codegen/box/callableReference/property/.
package foo
class A(val x: Int)
fun box(): String {
val p = A::x
if (p.get(A(42)) != 42) return "Fail 1"
if (p.get(A(-1)) != -1) return "Fail 2"
if (p.name != "x") return "Fail 3"
return "OK"
}
@@ -1,22 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1287
// This test was adapted from compiler/testData/codegen/box/callableReference/property/.
package foo
var storage = 0
var Int.foo: Int
get() {
return this + storage
}
set(value) {
storage = this + value
}
fun box(): String {
val pr = Int::foo
if (pr.get(42) != 42) return "Fail 1: ${pr.get(42)}"
pr.set(200, 39)
if (pr.get(-239) != 0) return "Fail 2: ${pr.get(-239)}"
if (storage != 239) return "Fail 3: $storage"
return "OK"
}
@@ -1,20 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1292
// This test was adapted from compiler/testData/codegen/box/callableReference/property/.
package foo
data class Box(var value: String)
fun box(): String {
val o = Box("lorem")
val prop = Box::value
if (prop.get(o) != "lorem") return "Fail 1: ${prop.get(o)}"
prop.set(o, "ipsum")
if (prop.get(o) != "ipsum") return "Fail 2: ${prop.get(o)}"
if (o.value != "ipsum") return "Fail 3: ${o.value}"
o.value = "dolor"
if (prop.get(o) != "dolor") return "Fail 4: ${prop.get(o)}"
if ("$o" != "Box(value=dolor)") return "Fail 5: $o"
return "OK"
}
@@ -1,16 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1293
// This test was adapted from compiler/testData/codegen/box/callableReference/property/.
package foo
data class Box(val value: String)
var pr = Box("first")
fun box(): String {
val property = ::pr
if (property.get() != Box("first")) return "Fail value: ${property.get()}"
if (property.name != "pr") return "Fail name: ${property.name}"
property.set(Box("second"))
if (property.get().value != "second") return "Fail value 2: ${property.get()}"
return "OK"
}
@@ -1,14 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1293
// This test was adapted from compiler/testData/codegen/box/callableReference/property/.
package foo
data class Box(val value: String)
val foo = Box("lol")
fun box(): String {
val property = ::foo
if (property.get() != Box("lol")) return "Fail value: ${property.get()}"
if (property.name != "foo") return "Fail name: ${property.name}"
return "OK"
}
-28
View File
@@ -1,28 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1297
// This test was adapted from compiler/testData/codegen/box/classes
package foo
interface Trait1 {
fun foo(): String
}
interface Trait2 {
fun bar(): String
}
class T1 : Trait1 {
override fun foo() = "aaa"
}
class T2 : Trait2 {
override fun bar() = "bbb"
}
class C(a: Trait1, b: Trait2) : Trait1 by a, Trait2 by b
fun box(): String {
val c = C(T1(), T2())
if (c.foo() != "aaa") return "fail"
if (c.bar() != "bbb") return "fail"
return "OK"
}
-39
View File
@@ -1,39 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1304
// This test was adapted from compiler/testData/codegen/box/classes
package foo
interface One {
public open fun foo(): Int
public open fun faz(): Int = 10
}
interface Two {
public open fun foo(): Int
public open fun quux(): Int = 100
}
class OneImpl : One {
public override fun foo() = 1
}
class TwoImpl : Two {
public override fun foo() = 2
}
class Test2(a: One, b: Two) : Two by b, One by a {
public override fun foo() = 0
}
fun box(): String {
var t2 = Test2(OneImpl(), TwoImpl())
if (t2.foo() != 0)
return "Fail #1"
if (t2.faz() != 10)
return "Fail #2"
if (t2.quux() != 100)
return "Fail #3"
if (t2 !is One)
return "Fail #4"
if (t2 !is Two)
return "Fail #5"
return "OK"
}
-32
View File
@@ -1,32 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1294
// This test was adapted from compiler/testData/codegen/box/classes
package foo
interface First {
public open fun foo(): Int
}
interface Second : First {
public open fun bar(): Int
}
class Impl : Second {
public override fun foo() = 1
public override fun bar() = 2
}
class Test(s: Second) : Second by s {}
fun box(): String {
var t = Test(Impl())
if (t.foo() != 1)
return "Fail #1"
if (t.bar() != 2)
return "Fail #2"
if (t !is First)
return "Fail #3"
if (t !is Second)
return "Fail #4"
return "OK"
}
@@ -1,16 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1290
// This test was adapted from compiler/testData/codegen/box/classes
package foo
interface A<T> {
fun foo(t: T): String
}
class Derived(a: A<Int>) : A<Int> by a
fun box(): String {
val o = object : A<Int> {
override fun foo(t: Int) = if (t == 42) "OK" else "Fail $t"
}
return Derived(o).foo(42)
}
@@ -1,36 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1298
// This test was adapted from compiler/testData/codegen/box/classes
package foo
interface TextField {
fun getText(): String
}
interface InputTextField : TextField {
fun setText(text: String)
}
interface MooableTextField : InputTextField {
fun moo(a: Int, b: Int, c: Int): Int
}
class SimpleTextField : MooableTextField {
private var text2 = ""
override fun getText() = text2
override fun setText(text: String) {
this.text2 = text
}
override fun moo(a: Int, b: Int, c: Int) = a + b + c
}
class TextFieldWrapper(textField: MooableTextField) : MooableTextField by textField
fun box(): String {
val textField = TextFieldWrapper(SimpleTextField())
textField.setText("hello world!")
if (!textField.getText().equals("hello world!")) return "FAIL #!1"
if (textField.moo(1, 2, 3) != 6) return "FAIL #2"
return "OK"
}
-25
View File
@@ -1,25 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1300
open class M() {
open var b: Int = 0
}
class N() : M() {
val a: Int
get() {
super.b = super.b + 1
return super.b + 1
}
override var b: Int = a + 1
val superb: Int
get() = super.b
}
fun box(): String {
val n = N()
n.a
n.b
n.superb
if (n.b == 3 && n.a == 4 && n.superb == 3) return "OK";
return "fail";
}
-12
View File
@@ -1,12 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1288
class C() {
companion object {
fun create() = C()
}
}
fun box(): String {
val c = C.create()
return if (c is C) "OK" else "fail"
}
@@ -1,8 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1282
fun box(): String {
return apply("OK", { arg: String -> arg })
}
fun apply(arg: String, f: (p: String) -> String): String {
return f(arg)
}
@@ -1,8 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1282
fun box(): String {
return if (apply(5) { arg: Int -> arg + 13 } == 18) "OK" else "fail"
}
fun apply(arg: Int, f: (p: Int) -> Int): Int {
return f(arg)
}
@@ -1,9 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1283
fun box(): String {
val cl = 39
return if (sum(200, { val ff = { cl }; ff() }) == 239) "OK" else "FAIL"
}
fun sum(arg: Int, f: () -> Int): Int {
return arg + f()
}
-43
View File
@@ -1,43 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1318
interface BK {
fun x(): Int = 50
}
interface K : BK {
override fun x(): Int = super.x() * 2
}
open class M() {
open fun x(): Int = 10
open var y = 500
}
open class N() : M(), K {
override fun x(): Int = 20
override var y = 200
inner open class C() : K {
fun test1() = x()
fun test2() = super<M>@N.x()
fun test3() = super<K>@N.x()
fun test4() = super<K>.x()
fun test5() = y
fun test6(): Int {
super<M>@N.y += 200
return super<M>@N.y
}
}
}
fun box(): String {
if (N().C().test1() != 100) return "test1 fail";
if (N().C().test2() != 10) return "test2 fail";
if (N().C().test3() != 100) return "test3 fail";
if (N().C().test4() != 100) return "test4 fail";
if (N().C().test5() != 200) return "test5 fail";
if (N().C().test6() != 700) return "test6 fail";
return "OK";
}
@@ -1,9 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1284
fun box(): String {
val cl = 39
return if (sum(200, { val m = { val r = { cl }; r() }; m() }) == 239) "OK" else "FAIL"
}
fun sum(arg: Int, f: () -> Int): Int {
return arg + f()
}
@@ -1,14 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1284
class Point(val x: Int, val y: Int)
fun box(): String {
val answer = apply(Point(3, 5), { scalar: Int ->
Point(x * scalar, y * scalar)
})
return if (answer.x == 6 && answer.y == 10) "OK" else "FAIL"
}
fun apply(arg: Point, f: Point.(scalar: Int) -> Point): Point {
return arg.f(2)
}
-21
View File
@@ -1,21 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1297
open class Base() {
fun n(n: Int): Int = n + 1
}
interface Abstract {
}
class Derived1() : Base(), Abstract {
}
class Derived2() : Abstract, Base() {
}
fun test(s: Base): Boolean = s.n(238) == 239
fun box(): String {
if (!test(Base())) return "Fail #1"
if (!test(Derived1())) return "Fail #2"
if (!test(Derived2())) return "Fail #3"
return "OK"
}
@@ -1,15 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1284
class Slot() {
var vitality: Int = 10000
fun increaseVitality(delta: Int) {
vitality = vitality + delta
if (vitality > 65535) vitality = 65535;
}
}
fun box(): String {
val s = Slot()
s.increaseVitality(1000)
if (s.vitality == 11000) return "OK" else return "fail"
}
-49
View File
@@ -1,49 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1319
// Changed when traits were introduced. May not make sense any more
open class X(val x: Int) {
}
interface Y {
abstract val y: Int
}
class YImpl(override val y: Int) : Y {
}
class Point(x: Int, yy: Int) : X(x), Y {
override val y: Int = yy
}
interface Abstract {
}
class P1(x: Int, yy: Y) : Abstract, X(x), Y by yy {
}
class P2(x: Int, yy: Y) : X(x), Abstract, Y by yy {
}
class P3(x: Int, yy: Y) : X(x), Y by yy, Abstract {
}
class P4(x: Int, yy: Y) : Y by yy, Abstract, X(x) {
}
fun box(): String {
if (X(239).x != 239) return "FAIL #1"
if (YImpl(239).y != 239) return "FAIL #2"
val p = Point(240, -1)
if (p.x + p.y != 239) return "FAIL #3"
val y = YImpl(-1)
val p1 = P1(240, y)
if (p1.x + p1.y != 239) return "FAIL #4"
val p2 = P2(240, y)
if (p2.x + p2.y != 239) return "FAIL #5"
val p3 = P3(240, y)
if (p3.x + p3.y != 239) return "FAIL #6"
val p4 = P4(240, y)
if (p4.x + p4.y != 239) return "FAIL #7"
return "OK"
}
@@ -1,15 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1291
class Outer() {
open class InnerBase() {
}
class InnerDerived() : InnerBase() {
}
public val foo: InnerBase? = InnerDerived()
}
fun box(): String {
val o = Outer()
return if (o.foo === null) "fail" else "OK"
}
@@ -1,14 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1292
open class Foo() {
fun xyzzy(): String = "xyzzy"
}
class Bar() : Foo() {
fun test(): String = xyzzy()
}
fun box(): String {
val bar = Bar()
val f = bar.test()
return if (f == "xyzzy") "OK" else "fail"
}
@@ -1,14 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1282
class C() {
public var f: Int
init {
f = 610
}
}
fun box(): String {
val c = C()
if (c.f != 610) return "fail"
return "OK"
}
@@ -1,20 +0,0 @@
// KJS_WITH_FULL_RUNTIME
// EXPECTED_REACHABLE_NODES: 1517
class World() {
public val items: ArrayList<Item> = ArrayList<Item>()
inner class Item() {
init {
items.add(this)
}
}
val foo = Item()
}
fun box() : String {
val w = World()
if (w.items.size != 1) return "fail"
return "OK"
}
-21
View File
@@ -1,21 +0,0 @@
// KJS_WITH_FULL_RUNTIME
// EXPECTED_REACHABLE_NODES: 1288
class Outer(val foo: StringBuilder) {
inner class Inner() {
fun len(): Int {
return foo.length
}
}
fun test(): Inner {
return Inner()
}
}
fun box(): String {
val sb = StringBuilder("xyzzy")
val o = Outer(sb)
val i = o.test()
val l = i.len()
return if (l != 5) "fail" else "OK"
}
-28
View File
@@ -1,28 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1280
fun box(): String {
val i: Int? = 7
val j: Int? = null
val k = 7
//verify errors
if (i == 7) {
}
if (7 == i) {
}
if (j == 7) {
}
if (7 == j) {
}
if (i == k) {
}
if (k == i) {
}
if (j == k) {
}
if (k == j) {
}
return "OK"
}
@@ -1,26 +0,0 @@
// KJS_WITH_FULL_RUNTIME
// EXPECTED_REACHABLE_NODES: 1518
class ArrayWrapper<T>() {
val contents = ArrayList<T>()
fun add(item: T) {
contents.add(item)
}
operator fun plus(b: ArrayWrapper<T>): ArrayWrapper<T> {
val result = ArrayWrapper<T>()
result.contents.addAll(contents)
result.contents.addAll(b.contents)
return result
}
}
fun box(): String {
val v1 = ArrayWrapper<String>()
val v2 = ArrayWrapper<String>()
v1.add("foo")
v2.add("bar")
val v3 = v1 + v2
return if (v3.contents.size == 2) "OK" else "fail"
}
@@ -1,28 +0,0 @@
// KJS_WITH_FULL_RUNTIME
// EXPECTED_REACHABLE_NODES: 1519
class ArrayWrapper<T>() {
val contents = ArrayList<T>()
fun add(item: T) {
contents.add(item)
}
operator fun plusAssign(rhs: ArrayWrapper<T>) {
contents.addAll(rhs.contents)
}
fun get(index: Int): T {
return contents.get(index)
}
}
fun box(): String {
var v1 = ArrayWrapper<String>()
val v2 = ArrayWrapper<String>()
v1.add("foo")
val v3 = v1
v2.add("bar")
v1 += v2
return if (v1.contents.size == 2 && v3.contents.size == 2) "OK" else "fail"
}
@@ -1,31 +0,0 @@
// KJS_WITH_FULL_RUNTIME
// EXPECTED_REACHABLE_NODES: 1519
class ArrayWrapper<T>() {
val contents = ArrayList<T>()
fun add(item: T) {
contents.add(item)
}
operator fun plus(rhs: ArrayWrapper<T>): ArrayWrapper<T> {
val result = ArrayWrapper<T>()
result.contents.addAll(contents)
result.contents.addAll(rhs.contents)
return result
}
fun get(index: Int): T {
return contents.get(index)
}
}
fun box(): String {
var v1 = ArrayWrapper<String>()
val v2 = ArrayWrapper<String>()
v1.add("foo")
val v3 = v1
v2.add("bar")
v1 += v2
return if (v1.contents.size == 2 && v3.contents.size == 1) "OK" else "fail"
}
@@ -1,29 +0,0 @@
// KJS_WITH_FULL_RUNTIME
// EXPECTED_REACHABLE_NODES: 1519
class ArrayWrapper<T>() {
val contents = ArrayList<T>()
fun add(item: T) {
contents.add(item)
}
operator fun unaryMinus(): ArrayWrapper<T> {
val result = ArrayWrapper<T>()
result.contents.addAll(contents)
result.contents.reverse()
return result
}
operator fun get(index: Int): T {
return contents.get(index)
}
}
fun box(): String {
val v1 = ArrayWrapper<String>()
v1.add("foo")
v1.add("bar")
val v2 = -v1
return if (v2[0] == "bar" && v2[1] == "foo") "OK" else "fail"
}
@@ -1,37 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1299
open class Base() {
val plain = 239
public val read: Int
get() = 239
public var readwrite: Int = 0
get() = field + 1
set(n: Int) {
field = n
}
}
interface Abstract {
}
class Derived1() : Base(), Abstract {
}
class Derived2() : Abstract, Base() {
}
fun code(s: Base): Int {
if (s.plain != 239) return 1
if (s.read != 239) return 2
s.readwrite = 238
if (s.readwrite != 239) return 3
return 0
}
fun test(s: Base): Boolean = code(s) == 0
fun box(): String {
if (!test(Base())) return "Fail #1"
if (!test(Derived1())) return "Fail #2"
if (!test(Derived2())) return "Fail #3"
return "OK"
}
@@ -1,17 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1291
class Outer() {
val s = "xyzzy"
open inner class InnerBase(public val name: String) {
}
inner class InnerDerived() : InnerBase(s) {
}
val x = InnerDerived()
}
fun box(): String {
val o = Outer()
return if (o.x.name != "xyzzy") "fail" else "OK"
}
@@ -1,22 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1293
// Changed when traits were introduced. May not make sense any more
interface Left {
}
open class Right() {
open fun f() = 42
}
class D() : Left, Right() {
override fun f() = 239
}
fun box(): String {
val r: Right = Right()
val d: D = D()
if (r.f() != 42) return "Fail #1"
if (d.f() != 239) return "Fail #2"
return "OK"
}
@@ -1,8 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1282
fun box(): String {
return invoker({ "OK" })
}
fun invoker(gen: () -> String): String {
return gen()
}
@@ -1,8 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1282
fun box(): String {
return if (int_invoker({ 7 }) == 7) "OK" else "fail"
}
fun int_invoker(gen: () -> Int): Int {
return gen()
}
-32
View File
@@ -1,32 +0,0 @@
// EXPECTED_REACHABLE_NODES: 1296
interface M {
var backingB: Int
var b: Int
get() = backingB
set(value: Int) {
backingB = value
}
}
class N() : M {
override var backingB: Int = 0
val a: Int
get() {
super.b = super.b + 1
return super.b + 1
}
override var b: Int = a + 1
val superb: Int
get() = super.b
}
fun box(): String {
val n = N()
n.a
n.b
n.superb
if (n.b == 3 && n.a == 4 && n.superb == 3) return "OK";
return "fail";
}