Migrate boxInline tests to new multi-file framework

This commit is contained in:
Alexander Udalov
2016-02-24 13:29:32 +03:00
committed by Alexander Udalov
parent fa1f7d988e
commit cc84aabdcf
586 changed files with 6946 additions and 5639 deletions
@@ -1,12 +0,0 @@
package test
abstract class A<R> {
abstract fun getO() : R
abstract fun getK() : R
}
inline fun <R> doWork(job: ()-> R) : R {
return job()
}
@@ -1,3 +1,20 @@
// FILE: 1.kt
package test
abstract class A<R> {
abstract fun getO() : R
abstract fun getK() : R
}
inline fun <R> doWork(job: ()-> R) : R {
return job()
}
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
import test.*
@@ -26,4 +43,3 @@ fun box() : String {
return "OK"
}
@@ -1,12 +0,0 @@
package test
abstract class A<R>(val param: R) {
abstract fun getO() : R
abstract fun getK() : R
}
inline fun <R> doWork(job: ()-> R) : R {
return job()
}
@@ -1,3 +1,20 @@
// FILE: 1.kt
package test
abstract class A<R>(val param: R) {
abstract fun getO() : R
abstract fun getK() : R
}
inline fun <R> doWork(job: ()-> R) : R {
return job()
}
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
import test.*
@@ -21,4 +38,4 @@ fun box() : String {
if (result != "OK11") return "fail $result"
return "OK"
}
}
@@ -1,30 +0,0 @@
//NO_CHECK_LAMBDA_INLINING
import test.*
fun test1(): String {
val o = "O"
val result = doWork ({o}, {"K"}, "GOOD")
return result.getO() + result.getK() + result.getParam()
}
fun test2() : String {
//same names as in object
val o1 = "O"
val k1 = "K"
val result = doWorkInConstructor ({o1}, {k1}, "GOOD")
return result.getO() + result.getK() + result.getParam()
}
fun box() : String {
val result1 = test1();
if (result1 != "OKGOOD") return "fail1 $result1"
val result2 = test2();
if (result2 != "OKGOOD") return "fail2 $result2"
return "OK"
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
@@ -47,4 +49,37 @@ inline fun <R> doWorkInConstructor(crossinline jobO: ()-> R, crossinline jobK: (
}
}
return s;
}
}
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
import test.*
fun test1(): String {
val o = "O"
val result = doWork ({o}, {"K"}, "GOOD")
return result.getO() + result.getK() + result.getParam()
}
fun test2() : String {
//same names as in object
val o1 = "O"
val k1 = "K"
val result = doWorkInConstructor ({o1}, {k1}, "GOOD")
return result.getO() + result.getK() + result.getParam()
}
fun box() : String {
val result1 = test1();
if (result1 != "OKGOOD") return "fail1 $result1"
val result2 = test2();
if (result2 != "OKGOOD") return "fail2 $result2"
return "OK"
}
@@ -1,30 +0,0 @@
//NO_CHECK_LAMBDA_INLINING
import test.*
fun test1(): String {
val o = "O"
val result = doWork ({o}, {"K"}, "11")
return result.getO() + result.getK() + result.param
}
fun test2() : String {
//same names as in object
val o1 = "O"
val k1 = "K"
val param = "11"
val result = doWorkInConstructor ({o1}, {k1}, {param})
return result.getO() + result.getK() + result.param
}
fun box() : String {
val result1 = test1();
if (result1 != "OK11") return "fail1 $result1"
val result2 = test2();
if (result2 != "OK11") return "fail2 $result2"
return "OK"
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
@@ -34,4 +36,37 @@ inline fun <R> doWorkInConstructor(crossinline jobO: ()-> R, crossinline jobK: (
}
}
return s;
}
}
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
import test.*
fun test1(): String {
val o = "O"
val result = doWork ({o}, {"K"}, "11")
return result.getO() + result.getK() + result.param
}
fun test2() : String {
//same names as in object
val o1 = "O"
val k1 = "K"
val param = "11"
val result = doWorkInConstructor ({o1}, {k1}, {param})
return result.getO() + result.getK() + result.param
}
fun box() : String {
val result1 = test1();
if (result1 != "OK11") return "fail1 $result1"
val result2 = test2();
if (result2 != "OK11") return "fail2 $result2"
return "OK"
}
@@ -1,6 +0,0 @@
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return bar {"OK"} ()
}
@@ -1,7 +0,0 @@
package test
inline fun bar(crossinline y: () -> String) = {
call(y)
}
public inline fun <T> call(f: () -> T): T = f()
@@ -0,0 +1,18 @@
// FILE: 1.kt
package test
inline fun bar(crossinline y: () -> String) = {
call(y)
}
public inline fun <T> call(f: () -> T): T = f()
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return bar {"OK"} ()
}
@@ -1,6 +0,0 @@
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return bar {"OK"} ()
}
@@ -1,7 +0,0 @@
package test
inline fun bar(crossinline y: () -> String) = {
{ { call(y) }() }()
}
public inline fun <T> call(f: () -> T): T = f()
@@ -0,0 +1,18 @@
// FILE: 1.kt
package test
inline fun bar(crossinline y: () -> String) = {
{ { call(y) }() }()
}
public inline fun <T> call(f: () -> T): T = f()
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return bar {"OK"} ()
}
@@ -1,7 +0,0 @@
package test
inline fun bar(crossinline y: () -> String) = {
{ { call(y) }() }()
}
public inline fun <T> call(crossinline f: () -> T): T = {{ f() }()}()
@@ -1,3 +1,15 @@
// FILE: 1.kt
package test
inline fun bar(crossinline y: () -> String) = {
{ { call(y) }() }()
}
public inline fun <T> call(crossinline f: () -> T): T = {{ f() }()}()
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
import test.*
@@ -1,6 +0,0 @@
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return bar { "OK" }.run()
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
internal interface A<T> {
@@ -14,4 +16,13 @@ public inline fun <T> call(crossinline f: () -> T): T = object : A<T> {
override fun run() : T {
return f()
}
}.run()
}.run()
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return bar { "OK" }.run()
}
@@ -1,7 +0,0 @@
//NO_CHECK_LAMBDA_INLINING
//KT-7490
import test.*
fun box(): String {
return Entity("OK").directed().calc().value
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
open class Entity(val value: String)
@@ -15,4 +17,14 @@ inline fun<reified Self : Entity> Self.directed(): Task<Self> =
object : Task<Self>() {
override fun calc(): Self = this@directed
}
}
}
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
//KT-7490
import test.*
fun box(): String {
return Entity("OK").directed().calc().value
}
@@ -1,5 +0,0 @@
import test.*
fun box(): String {
return A().doSomething().run()
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
interface Run {
@@ -10,4 +12,12 @@ internal class A {
override fun run(): String = "OK"
}
}
}
}
// FILE: 2.kt
import test.*
fun box(): String {
return A().doSomething().run()
}
@@ -1,5 +0,0 @@
import test.*
fun box(): String {
return A().doSomething()
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
internal class A {
@@ -6,4 +8,12 @@ internal class A {
"OK"
}()
}
}
}
// FILE: 2.kt
import test.*
fun box(): String {
return A().doSomething()
}
@@ -1,5 +0,0 @@
import test.*
fun box(): String {
return A().doSomething("OK")
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
internal class A {
@@ -6,4 +8,12 @@ internal class A {
s
}()
}
}
}
// FILE: 2.kt
import test.*
fun box(): String {
return A().doSomething("OK")
}
@@ -1,5 +0,0 @@
import test.*
fun box(): String {
return switch(X.A) + switch(X.B)
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
public enum class X { A, B }
@@ -5,4 +7,12 @@ public enum class X { A, B }
public inline fun switch(x: X): String = when (x) {
X.A -> "O"
X.B -> "K"
}
}
// FILE: 2.kt
import test.*
fun box(): String {
return switch(X.A) + switch(X.B)
}
@@ -1,3 +0,0 @@
package test
public inline fun <T, R> T.myLet(f: (T) -> R): R = f(this)
@@ -1,3 +1,11 @@
// FILE: 1.kt
package test
public inline fun <T, R> T.myLet(f: (T) -> R): R = f(this)
// FILE: 2.kt
import test.*
interface foo {
@@ -11,4 +19,4 @@ fun box(): String {
}
}
return baz.bar()
}
}
@@ -1,9 +0,0 @@
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
val test = Test("OK")
return test._parameter.property
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
class Test(val _member: String) {
@@ -14,4 +16,16 @@ interface Z {
inline fun test(s: () -> Z): Z {
return s()
}
}
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
val test = Test("OK")
return test._parameter.property
}
@@ -1,9 +0,0 @@
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
val test = Test("OK")
return test._parameter.property.property
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
class Test(val _member: String) {
@@ -18,4 +20,16 @@ interface Z<T> {
inline fun <T> test(s: () -> Z<T>): Z<T> {
return s()
}
}
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
val test = Test("OK")
return test._parameter.property.property
}
@@ -1,7 +0,0 @@
package test
inline fun inlineFun(p: () -> Unit) {
p()
}
@@ -1,3 +1,15 @@
// FILE: 1.kt
package test
inline fun inlineFun(p: () -> Unit) {
p()
}
// FILE: 2.kt
import test.*
public fun box(): String {
@@ -13,4 +25,4 @@ public fun box(): String {
}
return z;
}
}
@@ -1,10 +0,0 @@
package test
fun <T> T.noInline(p: (T) -> Unit) {
p(this)
}
inline fun inlineCall(p: () -> Unit) {
p()
}
@@ -1,3 +1,17 @@
// FILE: 1.kt
package test
fun <T> T.noInline(p: (T) -> Unit) {
p(this)
}
inline fun inlineCall(p: () -> Unit) {
p()
}
// FILE: 2.kt
import test.*
fun box(): String {
@@ -1,6 +0,0 @@
package test
inline fun inlineCall(p: () -> Unit) {
p()
}
@@ -1,3 +1,13 @@
// FILE: 1.kt
package test
inline fun inlineCall(p: () -> Unit) {
p()
}
// FILE: 2.kt
import test.*
fun box(): String {
@@ -1,7 +0,0 @@
import test.*
fun box(): String {
var result = "fail"
test { it -> result = it }
return result
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
interface A {
@@ -16,3 +18,12 @@ inline fun test(crossinline f: (String) -> Unit) {
testNested { it -> { f(it) }()}
}
// FILE: 2.kt
import test.*
fun box(): String {
var result = "fail"
test { it -> result = it }
return result
}
@@ -1,5 +0,0 @@
package test
inline fun <T> inlineFun(arg: T, f: (T) -> Unit) {
f(arg)
}
@@ -1,3 +1,13 @@
// FILE: 1.kt
package test
inline fun <T> inlineFun(arg: T, f: (T) -> Unit) {
f(arg)
}
// FILE: 2.kt
import test.*
fun box(): String {
@@ -1,7 +0,0 @@
package test
inline fun <T> inlineFun(arg: T, crossinline f: (T) -> Unit) {
{
f(arg)
}()
}
@@ -1,3 +1,15 @@
// FILE: 1.kt
package test
inline fun <T> inlineFun(arg: T, crossinline f: (T) -> Unit) {
{
f(arg)
}()
}
// FILE: 2.kt
import test.*
fun box(): String {
@@ -1,7 +0,0 @@
package test
inline fun <T> inlineFun(arg: T, crossinline f: (T) -> Unit) {
{
f(arg)
}()
}
@@ -1,3 +1,15 @@
// FILE: 1.kt
package test
inline fun <T> inlineFun(arg: T, crossinline f: (T) -> Unit) {
{
f(arg)
}()
}
// FILE: 2.kt
import test.*
fun box(): String {
@@ -1,7 +0,0 @@
package test
inline fun <T> inlineFun(arg: T, crossinline f: (T) -> Unit) {
{
f(arg)
}()
}
@@ -1,3 +1,15 @@
// FILE: 1.kt
package test
inline fun <T> inlineFun(arg: T, crossinline f: (T) -> Unit) {
{
f(arg)
}()
}
// FILE: 2.kt
import test.*
fun box(): String {
@@ -1,7 +0,0 @@
import test.*
fun box(): String {
var result = "fail"
test { it -> result = it }
return result
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
interface A {
@@ -16,3 +18,12 @@ fun test(f: (String) -> Unit) {
testNested { it -> { f(it) }()}
}
// FILE: 2.kt
import test.*
fun box(): String {
var result = "fail"
test { it -> result = it }
return result
}
@@ -1,7 +0,0 @@
import test.*
fun box(): String {
var result = "fail"
B("O", "K").test { it -> result = it }
return result
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
interface A {
@@ -19,4 +21,14 @@ class B(val o: String, val k: String) {
}
}
}
// FILE: 2.kt
import test.*
fun box(): String {
var result = "fail"
B("O", "K").test { it -> result = it }
return result
}
@@ -1,6 +0,0 @@
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return A().box()
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
class A {
@@ -27,4 +29,13 @@ class A {
return if (result == "start1_additional_2_additional_") "OK" else "fail: $result"
}
}
}
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return A().box()
}
@@ -1,6 +0,0 @@
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return A().box()
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
class A {
@@ -25,4 +27,13 @@ class A {
return if (result == "start1_additional_2_additional_") "OK" else "fail: $result"
}
}
}
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return A().box()
}
@@ -1,6 +0,0 @@
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return A().box()
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
class A {
@@ -21,4 +23,13 @@ class A {
return if (result == "start2_additional_") "OK" else "fail: $result"
}
}
}
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return A().box()
}
@@ -1,6 +0,0 @@
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return A().box()
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
class A {
@@ -23,4 +25,13 @@ class A {
return if (result == "start2_additional_") "OK" else "fail: $result"
}
}
}
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return A().box()
}
@@ -1,6 +0,0 @@
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return A().box()
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
class A {
@@ -26,4 +28,13 @@ class A {
return if (result == "start1_additional_2_additional_") "OK" else "fail: $result"
}
}
}
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return A().box()
}
@@ -1,6 +0,0 @@
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return A().box()
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
class A {
@@ -26,4 +28,13 @@ class A {
}
}
}
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return A().box()
}
@@ -1,7 +0,0 @@
import test.*
fun box(): String {
var result = "fail"
B("O", "fail").test { it -> result = it }
return result
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
interface A {
@@ -18,4 +20,14 @@ class B(val o: String, val k: String) {
testNested { it -> { f(it + "K") }() }
}
}
}
// FILE: 2.kt
import test.*
fun box(): String {
var result = "fail"
B("O", "fail").test { it -> result = it }
return result
}
@@ -1,8 +0,0 @@
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
var result = "fail"
B("O", "K").test { it -> result = it }
return result
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
interface A {
@@ -19,4 +21,15 @@ class B(val o: String, val k: String) {
}
}
}
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
var result = "fail"
B("O", "K").test { it -> result = it }
return result
}
@@ -1,7 +0,0 @@
import test.*
fun box(): String {
var result = ""
B("O", "K").test { it -> result += it }
return if (result == "OOKK") "OK" else "fail: $result"
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
interface A {
@@ -19,4 +21,14 @@ class B(val o: String, val k: String) {
testNested ({ it -> f(it + o) }) { it -> f(it + k) }
}
}
}
// FILE: 2.kt
import test.*
fun box(): String {
var result = ""
B("O", "K").test { it -> result += it }
return if (result == "OOKK") "OK" else "fail: $result"
}
@@ -1,7 +0,0 @@
import test.*
fun box(): String {
var result = ""
B("O", "K").test { it -> result += it }
return if (result == "OOKK") "OK" else "fail: $result"
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
interface A {
@@ -28,4 +30,14 @@ class B(val o: String, val k: String) {
}
}
}
// FILE: 2.kt
import test.*
fun box(): String {
var result = ""
B("O", "K").test { it -> result += it }
return if (result == "OOKK") "OK" else "fail: $result"
}
@@ -1,7 +0,0 @@
import test.*
fun box(): String {
var result = ""
B("O", "K").test { it -> result += it }
return if (result == "startOOKK") "OK" else "fail: $result"
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
interface A {
@@ -29,4 +31,14 @@ class B(val o: String, val k: String) {
}
}
}
// FILE: 2.kt
import test.*
fun box(): String {
var result = ""
B("O", "K").test { it -> result += it }
return if (result == "startOOKK") "OK" else "fail: $result"
}
@@ -1,10 +0,0 @@
import test.*
fun box(): String {
var result = "fail"
W("OK").safe {
result = this as String
}
return result
}
@@ -1,10 +0,0 @@
package test
class W(val value: Any)
inline fun W.safe(crossinline body : Any.() -> Unit) {
{
this.value?.body()
}()
}
@@ -0,0 +1,24 @@
// FILE: 1.kt
package test
class W(val value: Any)
inline fun W.safe(crossinline body : Any.() -> Unit) {
{
this.value?.body()
}()
}
// FILE: 2.kt
import test.*
fun box(): String {
var result = "fail"
W("OK").safe {
result = this as String
}
return result
}
@@ -1,12 +0,0 @@
import test.*
fun box(): String {
var result = "fail"
W("OK").safe {
{
result = this as String
}()
}
return result
}
@@ -1,10 +0,0 @@
package test
class W(val value: Any)
inline fun W.safe(crossinline body : Any.() -> Unit) {
{
this.value?.body()
}()
}
@@ -0,0 +1,26 @@
// FILE: 1.kt
package test
class W(val value: Any)
inline fun W.safe(crossinline body : Any.() -> Unit) {
{
this.value?.body()
}()
}
// FILE: 2.kt
import test.*
fun box(): String {
var result = "fail"
W("OK").safe {
{
result = this as String
}()
}
return result
}
@@ -1,6 +0,0 @@
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return A().testCall()
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
class A {
@@ -17,4 +19,13 @@ class A {
l() + callK()
}()
}
}
}
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return A().testCall()
}
@@ -1,6 +0,0 @@
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return Person("OK").sayName()
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
class Person(val name: String) {
@@ -13,3 +15,11 @@ class Person(val name: String) {
inline fun nestedSayName2(call: () -> String) = call()
}
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return Person("OK").sayName()
}
@@ -1,9 +0,0 @@
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
val res = Person("OK").sayName()
if (res != "OKsubOK") return "fail: $res"
return "OK"
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
class Person(val name: String) {
@@ -12,3 +14,15 @@ class Person(val name: String) {
inline fun nestedSayName2(call: () -> String) = name + call()
}
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
val res = Person("OK").sayName()
if (res != "OKsubOK") return "fail: $res"
return "OK"
}
@@ -1,6 +0,0 @@
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return Company("OK").sayName()
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
class Company(val name: String) {
@@ -15,3 +17,12 @@ class Person(val name: String) {
fun companyName(call: () -> String) = call()
}
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return Company("OK").sayName()
}
@@ -1,6 +0,0 @@
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return Person("OK").sayName()
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
fun Person.sayName() = doSayName { name }
@@ -12,3 +14,11 @@ inline fun Person.parsonName(call: () -> String) = call()
fun Person.companyName(call: () -> String) = call()
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return Person("OK").sayName()
}