Remove duplicate tests from JS compiler test set. Merge chages to common compiler tests
This commit is contained in:
-13
@@ -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())
|
||||
-26
@@ -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"
|
||||
}
|
||||
-15
@@ -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"
|
||||
}
|
||||
-16
@@ -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"
|
||||
}
|
||||
Vendored
-13
@@ -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
|
||||
}
|
||||
-14
@@ -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
|
||||
}
|
||||
Vendored
-18
@@ -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
|
||||
}
|
||||
Vendored
-18
@@ -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
|
||||
}
|
||||
-13
@@ -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
|
||||
}
|
||||
-9
@@ -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
|
||||
Vendored
-7
@@ -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())
|
||||
}
|
||||
-11
@@ -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()
|
||||
-11
@@ -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()
|
||||
Vendored
-22
@@ -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"
|
||||
}
|
||||
Vendored
-20
@@ -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"
|
||||
}
|
||||
Vendored
-19
@@ -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
|
||||
}
|
||||
Vendored
-32
@@ -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"
|
||||
}
|
||||
-8
@@ -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"
|
||||
}
|
||||
-15
@@ -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")
|
||||
}
|
||||
-23
@@ -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"
|
||||
}
|
||||
-23
@@ -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"
|
||||
}
|
||||
Vendored
-21
@@ -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"
|
||||
}
|
||||
-19
@@ -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"
|
||||
}
|
||||
Reference in New Issue
Block a user