Move around some codegen box tests
In tests merged from boxAgainstJava in 29b96aa1, some directories were
named slightly differently compared to box, e.g. "property" vs
"properties", "varargs" vs "vararg". This change renames these, moves
some of the tests to more fitting directories, and also renames
"visibility" to "javaVisibility" because it's about Java visibilities
specifically.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
// IGNORE_BACKEND: JVM
|
||||
// TARGET_BACKEND: JVM
|
||||
// MODULE: lib
|
||||
// FILE: test/Parent.java
|
||||
|
||||
package test;
|
||||
|
||||
public class Parent {
|
||||
protected String qqq = "";
|
||||
|
||||
public String getQqq() {
|
||||
return qqq;
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: 1.kt
|
||||
|
||||
import test.Parent
|
||||
|
||||
open class Child : Parent() {
|
||||
inner class QQQ {
|
||||
fun z(x: Parent?) {
|
||||
x as Child
|
||||
val q = x.qqq
|
||||
x.qqq = q + "OK"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val c = Child()
|
||||
val d = c.QQQ()
|
||||
d.z(c)
|
||||
return c.qqq
|
||||
}
|
||||
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// MODULE: lib
|
||||
// FILE: protectedPack/J.java
|
||||
|
||||
package protectedPack;
|
||||
|
||||
public class J {
|
||||
protected String foo() {
|
||||
return "fail";
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: 1.kt
|
||||
|
||||
package protectedPackKotlin
|
||||
|
||||
import protectedPack.J
|
||||
|
||||
class Derived : J() {
|
||||
protected override fun foo(): String? {
|
||||
return "OK"
|
||||
}
|
||||
|
||||
fun test(): String {
|
||||
return foo()!!
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Derived().test()
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// MODULE: lib
|
||||
// FILE: protectedPack/A.java
|
||||
package protectedPack;
|
||||
|
||||
public class A {
|
||||
protected final String field;
|
||||
|
||||
public A(String value) {
|
||||
field = value;
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: B.kt
|
||||
import protectedPack.A
|
||||
|
||||
class B(value: String) : A(value) {
|
||||
inner class C : A(field) {
|
||||
val result = field
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String = B("OK").C().result
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// MODULE: lib
|
||||
// FILE: protectedPack/J.java
|
||||
|
||||
package protectedPack;
|
||||
|
||||
public class J {
|
||||
protected String foo() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: 1.kt
|
||||
|
||||
package protectedPack
|
||||
|
||||
fun box(): String {
|
||||
return J().foo()!!
|
||||
}
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// MODULE: lib
|
||||
// FILE: protectedPack/J.java
|
||||
|
||||
package protectedPack;
|
||||
|
||||
public class J {
|
||||
protected String foo = "OK";
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: 1.kt
|
||||
|
||||
package protectedPack
|
||||
|
||||
fun box(): String {
|
||||
return J().foo!!
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// MODULE: lib
|
||||
// FILE: protectedPack/J.java
|
||||
|
||||
package protectedPack;
|
||||
|
||||
public class J {
|
||||
protected String foo = "OK";
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: 1.kt
|
||||
|
||||
package protectedPack
|
||||
|
||||
inline fun foo(crossinline bar: () -> String) = object {
|
||||
fun baz() = bar()
|
||||
}.baz()
|
||||
|
||||
fun box(): String {
|
||||
return foo { J().foo!! }
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// MODULE: lib
|
||||
// FILE: protectedPack/J.java
|
||||
|
||||
package protectedPack;
|
||||
|
||||
public class J {
|
||||
protected static class Inner {
|
||||
public String foo() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: 1.kt
|
||||
|
||||
package protectedPack
|
||||
|
||||
class Derived : J() {
|
||||
fun test(): String {
|
||||
return J.Inner().foo()!!
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Derived().test()
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// MODULE: lib
|
||||
// FILE: test/Foo.java
|
||||
package test;
|
||||
|
||||
public class Foo {
|
||||
protected final String value;
|
||||
|
||||
protected Foo(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: test.kt
|
||||
import test.Foo
|
||||
|
||||
class Bar : Foo("OK") {
|
||||
fun baz() = super.value
|
||||
}
|
||||
|
||||
fun box(): String = Bar().baz()
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// MODULE: lib
|
||||
// FILE: test/Foo.java
|
||||
|
||||
package test;
|
||||
|
||||
public class Foo {
|
||||
protected void foo(Runnable r) {
|
||||
r.run();
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: test.kt
|
||||
|
||||
package other
|
||||
|
||||
import test.Foo
|
||||
|
||||
class Bar : Foo() {
|
||||
fun bar() {
|
||||
foo {}
|
||||
foo(Runnable {})
|
||||
// super.foo {}
|
||||
super.foo(Runnable {})
|
||||
this.foo {}
|
||||
this.foo(Runnable {})
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
Bar().bar()
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user