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,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"
}