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,18 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// MODULE: lib
|
||||
// FILE: J.java
|
||||
|
||||
import java.lang.String;
|
||||
|
||||
class J {
|
||||
String value;
|
||||
|
||||
J(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: 1.kt
|
||||
|
||||
fun box() = J("OK").value
|
||||
@@ -0,0 +1,20 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// MODULE: lib
|
||||
// FILE: protectedPack/J.java
|
||||
|
||||
package protectedPack;
|
||||
|
||||
class J {
|
||||
public String test() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: 1.kt
|
||||
|
||||
package protectedPack
|
||||
|
||||
fun box(): String {
|
||||
return J().test()!!
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// MODULE: lib
|
||||
// FILE: protectedPack/J.java
|
||||
|
||||
package protectedPack;
|
||||
|
||||
public class J {
|
||||
String test() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: 1.kt
|
||||
|
||||
package protectedPack
|
||||
|
||||
fun box(): String {
|
||||
return J().test()!!
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// MODULE: lib
|
||||
// FILE: protectedPack/J.java
|
||||
|
||||
package protectedPack;
|
||||
|
||||
public class J {
|
||||
String test = "OK";
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: 1.kt
|
||||
|
||||
package protectedPack
|
||||
|
||||
fun box(): String {
|
||||
return J().test!!
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// MODULE: lib
|
||||
// FILE: J.java
|
||||
|
||||
public class J {
|
||||
protected final String protectedProperty;
|
||||
|
||||
public J(String str) {
|
||||
protectedProperty = str;
|
||||
}
|
||||
|
||||
protected static String protectedFun() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: 1.kt
|
||||
|
||||
class A : J(J.protectedFun()) {
|
||||
fun test(): String {
|
||||
return protectedProperty!!
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return A().test()
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// MODULE: lib
|
||||
// FILE: J.java
|
||||
|
||||
public class J {
|
||||
protected static String protectedFun() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: 1.kt
|
||||
|
||||
class A {
|
||||
companion object : J() {
|
||||
fun test(): String {
|
||||
return J.protectedFun()!!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return A.test()
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// MODULE: lib
|
||||
// FILE: J.java
|
||||
|
||||
public class J<T> {
|
||||
protected static String protectedFun() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: 1.kt
|
||||
|
||||
class Derived : J<String>() {
|
||||
fun test(): String {
|
||||
return J.protectedFun()!!
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Derived().test()
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// MODULE: lib
|
||||
// FILE: J.java
|
||||
|
||||
public class J {
|
||||
public static class Inner {
|
||||
protected static String protectedFun() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: 1.kt
|
||||
|
||||
class Derived : J.Inner() {
|
||||
fun test(): String {
|
||||
return J.Inner.protectedFun()!!
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Derived().test()
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// MODULE: lib
|
||||
// FILE: J.java
|
||||
|
||||
public class J {
|
||||
public static class A {
|
||||
public static class B {
|
||||
protected static String protectedFun() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: 1.kt
|
||||
|
||||
class Derived : J.A.B() {
|
||||
fun test(): String {
|
||||
return J.A.B.protectedFun()!!
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Derived().test()
|
||||
}
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// MODULE: lib
|
||||
// FILE: J.java
|
||||
|
||||
public class J<T> {
|
||||
public static class Inner<S> {
|
||||
protected static String protectedFun() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: 1.kt
|
||||
|
||||
class Derived : J.Inner<String>() {
|
||||
fun test(): String {
|
||||
return J.Inner.protectedFun()!!
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Derived().test()
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// MODULE: lib
|
||||
// FILE: J.java
|
||||
|
||||
public class J {
|
||||
protected static String protectedFun() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: 1.kt
|
||||
|
||||
open class A : J() {}
|
||||
|
||||
class Derived : A() {
|
||||
fun test(): String {
|
||||
return J.protectedFun()!!
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Derived().test()
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// MODULE: lib
|
||||
// FILE: J.java
|
||||
|
||||
public class J {
|
||||
protected static String protectedFun() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: 1.kt
|
||||
|
||||
object A : J() {
|
||||
fun test(): String {
|
||||
return J.protectedFun()!!
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return A.test()
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// MODULE: lib
|
||||
// FILE: Base.java
|
||||
|
||||
public class Base {
|
||||
protected static class Inner {
|
||||
public Inner() {}
|
||||
public String foo() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: 1.kt
|
||||
|
||||
class Derived : Base() {
|
||||
fun test(): String {
|
||||
return Base.Inner().foo()!!
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Derived().test()
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// MODULE: lib
|
||||
// FILE: Base.java
|
||||
|
||||
public class Base {
|
||||
public static class A {
|
||||
protected static class B {
|
||||
public B() {
|
||||
}
|
||||
|
||||
public String foo() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: 1.kt
|
||||
|
||||
class Derived : Base.A() {
|
||||
fun test(): String {
|
||||
return Base.A.B().foo()!!
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Derived().test()
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// MODULE: lib
|
||||
// FILE: Base.java
|
||||
|
||||
public class Base {
|
||||
protected static String protectedFun() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: 1.kt
|
||||
|
||||
class Derived : Base() {
|
||||
fun test(): String {
|
||||
return Base.protectedFun()!!
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Derived().test()
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// MODULE: lib
|
||||
// FILE: Base.java
|
||||
|
||||
public class Base {
|
||||
protected static final String protectedProperty = "OK";
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: 1.kt
|
||||
|
||||
class Derived : Base() {
|
||||
fun test(): String {
|
||||
return Base.protectedProperty!!
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Derived().test()
|
||||
}
|
||||
Reference in New Issue
Block a user