Migrate CompileKotlinAgainstKotlin test to multi-file framework
This commit is contained in:
committed by
Alexander Udalov
parent
5884d4be79
commit
cc8af573f9
@@ -1,9 +0,0 @@
|
|||||||
package a
|
|
||||||
|
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
|
||||||
annotation class Ann
|
|
||||||
|
|
||||||
interface Tr {
|
|
||||||
@Ann
|
|
||||||
fun foo() {}
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package a
|
|
||||||
|
|
||||||
object CartRoutes {
|
|
||||||
class RemoveOrderItem()
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package library
|
|
||||||
|
|
||||||
public enum class EnumClass {
|
|
||||||
ENTRY;
|
|
||||||
|
|
||||||
public companion object {
|
|
||||||
public fun entry(): EnumClass = ENTRY
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
import library.EnumClass
|
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
|
||||||
if (EnumClass.entry() != EnumClass.ENTRY) throw AssertionError()
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
class A {
|
|
||||||
companion object {
|
|
||||||
fun foo() = 42
|
|
||||||
val bar = "OK"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
fun main(args: Array<String>) {
|
|
||||||
if (A.foo() != 42) throw Exception()
|
|
||||||
if (A.bar != "OK") throw Exception()
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
class A(vararg s: String) {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
package aaa
|
|
||||||
|
|
||||||
class A(val a: Int = 1)
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
fun main(args: Array<String>) {
|
|
||||||
aaa.A()
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package aaa
|
|
||||||
|
|
||||||
class A {
|
|
||||||
class B {
|
|
||||||
class O {
|
|
||||||
val s = "OK"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
fun main(args: Array<String>) {
|
|
||||||
val str = aaa.A.B.O().s
|
|
||||||
if (str != "OK") {
|
|
||||||
throw Exception()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
package aaa
|
|
||||||
|
|
||||||
enum class E {
|
|
||||||
TRIVIAL_ENTRY,
|
|
||||||
SUBCLASS { }
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
//This a test for blinking bug from KT-3124
|
|
||||||
package some
|
|
||||||
|
|
||||||
public object SOME_OBJECT {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
import constants.*
|
|
||||||
|
|
||||||
@AnnotationClass("$b $s $i $l $f $d $bb $c $str")
|
|
||||||
class DummyClass()
|
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
|
||||||
val klass = DummyClass::class.java
|
|
||||||
val annotationClass = AnnotationClass::class.java
|
|
||||||
val annotation = klass.getAnnotation(annotationClass)!!
|
|
||||||
val value = annotation.value
|
|
||||||
require(value == "100 20000 2000000 2000000000000 3.14 3.14 true \u03c0 :)", { "Annotation value: $value" })
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
//test for KT-3702 Inner class constructor cannot be invoked in override function with receiver
|
|
||||||
package second
|
|
||||||
|
|
||||||
public class Outer() {
|
|
||||||
inner class Inner(test: String)
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
class A {
|
|
||||||
val OK: String = "OK"
|
|
||||||
@JvmName("OK") get
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
fun main(args: Array<String>) {
|
|
||||||
if (A().OK != "OK") throw java.lang.AssertionError()
|
|
||||||
}
|
|
||||||
-21
@@ -1,21 +0,0 @@
|
|||||||
package a
|
|
||||||
|
|
||||||
const val i = 2
|
|
||||||
const val s = 2.toShort()
|
|
||||||
const val f = 2.0.toFloat()
|
|
||||||
const val d = 2.0
|
|
||||||
const val l = 2L
|
|
||||||
const val b = 2.toByte()
|
|
||||||
const val bool = true
|
|
||||||
const val c = 'c'
|
|
||||||
const val str = "str"
|
|
||||||
|
|
||||||
const val i2 = i
|
|
||||||
const val s2 = s
|
|
||||||
const val f2 = f
|
|
||||||
const val d2 = d
|
|
||||||
const val l2 = l
|
|
||||||
const val b2 = b
|
|
||||||
const val bool2 = bool
|
|
||||||
const val c2 = c
|
|
||||||
const val str2 = str
|
|
||||||
Vendored
-6
@@ -1,6 +0,0 @@
|
|||||||
@file:[JvmName("Test") JvmMultifileClass]
|
|
||||||
|
|
||||||
val property = "K"
|
|
||||||
|
|
||||||
inline fun K(body: () -> String): String =
|
|
||||||
body() + property
|
|
||||||
Vendored
-4
@@ -1,4 +0,0 @@
|
|||||||
fun main(args: Array<String>) {
|
|
||||||
val ok = K { "O" }
|
|
||||||
if (ok != "OK") throw java.lang.AssertionError("Expected: OK, actual: $ok")
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package aaa
|
|
||||||
|
|
||||||
class A {
|
|
||||||
class O {
|
|
||||||
val s = "OK"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package aaa
|
|
||||||
|
|
||||||
class A {
|
|
||||||
enum class E {
|
|
||||||
A
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package aaa
|
|
||||||
|
|
||||||
class A {
|
|
||||||
object O {
|
|
||||||
val s = "OK"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
import lib.*
|
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
|
||||||
foo()
|
|
||||||
|
|
||||||
v = 1
|
|
||||||
println(v)
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package aaa
|
|
||||||
|
|
||||||
import kotlin.jvm.*
|
|
||||||
|
|
||||||
public object TestObject {
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
public val test: String = "test"
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
fun main(args: Array<String>) {
|
|
||||||
val h = aaa.TestObject.test
|
|
||||||
if (h != "test") {
|
|
||||||
throw Exception()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package test
|
|
||||||
|
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
fun printStream() = System.out
|
|
||||||
fun list() = Collections.emptyList<String>()
|
|
||||||
fun array(a: Array<Int>) = Arrays.copyOf(a, 2)
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
package a
|
|
||||||
|
|
||||||
public var topLevel: Int = 42
|
|
||||||
|
|
||||||
public val String.extension: Long
|
|
||||||
get() = length.toLong()
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package a
|
|
||||||
|
|
||||||
interface Rec<R, out T: Rec<R, T>> {
|
|
||||||
fun t(): T
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Super {
|
|
||||||
fun foo(p: Rec<*, *>) = p.t()
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
open class A {
|
|
||||||
val prop: String
|
|
||||||
constructor(x1: String, x2: String = "abc") {
|
|
||||||
prop = "$x1#$x2"
|
|
||||||
}
|
|
||||||
constructor(x1: Long) {
|
|
||||||
prop = "$x1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
package aaa
|
|
||||||
|
|
||||||
fun hello() = 17
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
import pkg.ClassA
|
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
|
||||||
val obj = ClassA.DEFAULT
|
|
||||||
obj.toString()
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package aaa
|
|
||||||
|
|
||||||
enum class E {
|
|
||||||
TRIVIAL_ENTRY,
|
|
||||||
SUBCLASS { };
|
|
||||||
|
|
||||||
class Nested {
|
|
||||||
fun fortyTwo() = 42
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+15
-1
@@ -1,3 +1,17 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
|
package a
|
||||||
|
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
annotation class Ann
|
||||||
|
|
||||||
|
interface Tr {
|
||||||
|
@Ann
|
||||||
|
fun foo() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
class C : a.Tr
|
class C : a.Tr
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
@@ -6,4 +20,4 @@ fun main(args: Array<String>) {
|
|||||||
if (annotations != "@a.Ann()") {
|
if (annotations != "@a.Ann()") {
|
||||||
throw AssertionError(annotations)
|
throw AssertionError(annotations)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+10
@@ -1,3 +1,13 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
|
package a
|
||||||
|
|
||||||
|
object CartRoutes {
|
||||||
|
class RemoveOrderItem()
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
import a.CartRoutes
|
import a.CartRoutes
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
|
package library
|
||||||
|
|
||||||
|
public enum class EnumClass {
|
||||||
|
ENTRY;
|
||||||
|
|
||||||
|
public companion object {
|
||||||
|
public fun entry(): EnumClass = ENTRY
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
|
import library.EnumClass
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
if (EnumClass.entry() != EnumClass.ENTRY) throw AssertionError()
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
|
class A {
|
||||||
|
companion object {
|
||||||
|
fun foo() = 42
|
||||||
|
val bar = "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
if (A.foo() != 42) throw Exception()
|
||||||
|
if (A.bar != "OK") throw Exception()
|
||||||
|
}
|
||||||
+8
@@ -1,3 +1,11 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
|
class A(vararg s: String) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
A()
|
A()
|
||||||
A("a")
|
A("a")
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
|
package aaa
|
||||||
|
|
||||||
|
class A(val a: Int = 1)
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
aaa.A()
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
|
package aaa
|
||||||
|
|
||||||
|
class A {
|
||||||
|
class B {
|
||||||
|
class O {
|
||||||
|
val s = "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
val str = aaa.A.B.O().s
|
||||||
|
if (str != "OK") {
|
||||||
|
throw Exception()
|
||||||
|
}
|
||||||
|
}
|
||||||
+11
@@ -1,3 +1,14 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
|
package aaa
|
||||||
|
|
||||||
|
enum class E {
|
||||||
|
TRIVIAL_ENTRY,
|
||||||
|
SUBCLASS { }
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
import aaa.E
|
import aaa.E
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
+11
-1
@@ -1,7 +1,17 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
|
package some
|
||||||
|
|
||||||
|
public object SOME_OBJECT {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
//This a test for blinking bug from KT-3124
|
//This a test for blinking bug from KT-3124
|
||||||
|
|
||||||
import some.SOME_OBJECT
|
import some.SOME_OBJECT
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
val a = SOME_OBJECT
|
val a = SOME_OBJECT
|
||||||
}
|
}
|
||||||
+17
@@ -1,3 +1,5 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
package constants
|
package constants
|
||||||
|
|
||||||
public const val b: Byte = 100
|
public const val b: Byte = 100
|
||||||
@@ -13,3 +15,18 @@ public const val str: String = ":)"
|
|||||||
|
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
public annotation class AnnotationClass(public val value: String)
|
public annotation class AnnotationClass(public val value: String)
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
|
import constants.*
|
||||||
|
|
||||||
|
@AnnotationClass("$b $s $i $l $f $d $bb $c $str")
|
||||||
|
class DummyClass()
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
val klass = DummyClass::class.java
|
||||||
|
val annotationClass = AnnotationClass::class.java
|
||||||
|
val annotation = klass.getAnnotation(annotationClass)!!
|
||||||
|
val value = annotation.value
|
||||||
|
require(value == "100 20000 2000000 2000000000000 3.14 3.14 true \u03c0 :)", { "Annotation value: $value" })
|
||||||
|
}
|
||||||
+11
-1
@@ -1,3 +1,13 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
|
package second
|
||||||
|
|
||||||
|
public class Outer() {
|
||||||
|
inner class Inner(test: String)
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
//test for KT-3702 Inner class constructor cannot be invoked in override function with receiver
|
//test for KT-3702 Inner class constructor cannot be invoked in override function with receiver
|
||||||
import second.Outer
|
import second.Outer
|
||||||
|
|
||||||
@@ -7,4 +17,4 @@ fun Outer.testExt() {
|
|||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
Outer().testExt()
|
Outer().testExt()
|
||||||
}
|
}
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
open class A {
|
|
||||||
@JvmField public val publicField = "1";
|
|
||||||
@JvmField internal val internalField = "2";
|
|
||||||
@JvmField protected val protectedfield = "3";
|
|
||||||
}
|
|
||||||
|
|
||||||
open class B : A() {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
open class C : B() {
|
|
||||||
fun test(): String {
|
|
||||||
return super.publicField + super.internalField + super.protectedfield
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
|
||||||
C().test()
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
|
open class A {
|
||||||
|
@JvmField public val publicField = "1";
|
||||||
|
@JvmField internal val internalField = "2";
|
||||||
|
@JvmField protected val protectedfield = "3";
|
||||||
|
}
|
||||||
|
|
||||||
|
open class B : A() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
|
open class C : B() {
|
||||||
|
fun test(): String {
|
||||||
|
return super.publicField + super.internalField + super.protectedfield
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
C().test()
|
||||||
|
}
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
open class A(@JvmField public val publicField: String = "1",
|
|
||||||
@JvmField internal val internalField: String = "2",
|
|
||||||
@JvmField protected val protectedfield: String = "3")
|
|
||||||
|
|
||||||
open class B : A()
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
open class C : B() {
|
|
||||||
fun test(): String {
|
|
||||||
return super.publicField + super.internalField + super.protectedfield
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
|
||||||
C().test()
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
|
open class A(@JvmField public val publicField: String = "1",
|
||||||
|
@JvmField internal val internalField: String = "2",
|
||||||
|
@JvmField protected val protectedfield: String = "3")
|
||||||
|
|
||||||
|
open class B : A()
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
|
open class C : B() {
|
||||||
|
fun test(): String {
|
||||||
|
return super.publicField + super.internalField + super.protectedfield
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
C().test()
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
|
class A {
|
||||||
|
val OK: String = "OK"
|
||||||
|
@JvmName("OK") get
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
if (A().OK != "OK") throw java.lang.AssertionError()
|
||||||
|
}
|
||||||
+26
@@ -1,3 +1,29 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
|
package a
|
||||||
|
|
||||||
|
const val i = 2
|
||||||
|
const val s = 2.toShort()
|
||||||
|
const val f = 2.0.toFloat()
|
||||||
|
const val d = 2.0
|
||||||
|
const val l = 2L
|
||||||
|
const val b = 2.toByte()
|
||||||
|
const val bool = true
|
||||||
|
const val c = 'c'
|
||||||
|
const val str = "str"
|
||||||
|
|
||||||
|
const val i2 = i
|
||||||
|
const val s2 = s
|
||||||
|
const val f2 = f
|
||||||
|
const val d2 = d
|
||||||
|
const val l2 = l
|
||||||
|
const val b2 = b
|
||||||
|
const val bool2 = bool
|
||||||
|
const val c2 = c
|
||||||
|
const val str2 = str
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
import a.*
|
import a.*
|
||||||
|
|
||||||
@Ann(i, s, f, d, l, b, bool, c, str)
|
@Ann(i, s, f, d, l, b, bool, c, str)
|
||||||
Vendored
+15
@@ -0,0 +1,15 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
|
@file:[JvmName("Test") JvmMultifileClass]
|
||||||
|
|
||||||
|
val property = "K"
|
||||||
|
|
||||||
|
inline fun K(body: () -> String): String =
|
||||||
|
body() + property
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
val ok = K { "O" }
|
||||||
|
if (ok != "OK") throw java.lang.AssertionError("Expected: OK, actual: $ok")
|
||||||
|
}
|
||||||
+12
@@ -1,3 +1,15 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
|
package aaa
|
||||||
|
|
||||||
|
class A {
|
||||||
|
class O {
|
||||||
|
val s = "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
val str = aaa.A.O().s
|
val str = aaa.A.O().s
|
||||||
if (str != "OK") {
|
if (str != "OK") {
|
||||||
+12
@@ -1,3 +1,15 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
|
package aaa
|
||||||
|
|
||||||
|
class A {
|
||||||
|
enum class E {
|
||||||
|
A
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
val str = aaa.A.E.A
|
val str = aaa.A.E.A
|
||||||
if (str.toString() != "A") {
|
if (str.toString() != "A") {
|
||||||
+12
@@ -1,3 +1,15 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
|
package aaa
|
||||||
|
|
||||||
|
class A {
|
||||||
|
object O {
|
||||||
|
val s = "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
val str = aaa.A.O.s
|
val str = aaa.A.O.s
|
||||||
if (str != "OK") {
|
if (str != "OK") {
|
||||||
+13
@@ -1,3 +1,5 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
package lib
|
package lib
|
||||||
|
|
||||||
@JvmName("bar")
|
@JvmName("bar")
|
||||||
@@ -8,3 +10,14 @@ var v: Int = 1
|
|||||||
get
|
get
|
||||||
@JvmName("vset")
|
@JvmName("vset")
|
||||||
set
|
set
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
|
import lib.*
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
foo()
|
||||||
|
|
||||||
|
v = 1
|
||||||
|
println(v)
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
|
package aaa
|
||||||
|
|
||||||
|
import kotlin.jvm.*
|
||||||
|
|
||||||
|
public object TestObject {
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public val test: String = "test"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
val h = aaa.TestObject.test
|
||||||
|
if (h != "test") {
|
||||||
|
throw Exception()
|
||||||
|
}
|
||||||
|
}
|
||||||
+13
-1
@@ -1,3 +1,15 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
|
package test
|
||||||
|
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
fun printStream() = System.out
|
||||||
|
fun list() = Collections.emptyList<String>()
|
||||||
|
fun array(a: Array<Int>) = Arrays.copyOf(a, 2)
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
import java.io.PrintStream
|
import java.io.PrintStream
|
||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
import test.*
|
import test.*
|
||||||
@@ -19,4 +31,4 @@ fun main(args: Array<String>) {
|
|||||||
a[0] = 1
|
a[0] = 1
|
||||||
val a1: Inv<Array<Int>> = inv(a)
|
val a1: Inv<Array<Int>> = inv(a)
|
||||||
val a2: Inv<Array<out Int>?> = inv(a)
|
val a2: Inv<Array<out Int>?> = inv(a)
|
||||||
}
|
}
|
||||||
+11
@@ -1,3 +1,14 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
|
package a
|
||||||
|
|
||||||
|
public var topLevel: Int = 42
|
||||||
|
|
||||||
|
public val String.extension: Long
|
||||||
|
get() = length.toLong()
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
import a.*
|
import a.*
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
+15
-1
@@ -1,3 +1,17 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
|
package a
|
||||||
|
|
||||||
|
interface Rec<R, out T: Rec<R, T>> {
|
||||||
|
fun t(): T
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Super {
|
||||||
|
fun foo(p: Rec<*, *>) = p.t()
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
import a.*
|
import a.*
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
@@ -8,4 +22,4 @@ fun main(args: Array<String>) {
|
|||||||
|
|
||||||
fun test(s: Super, p: Rec<*, *>) {
|
fun test(s: Super, p: Rec<*, *>) {
|
||||||
s.foo(p).t().t().t()
|
s.foo(p).t().t().t()
|
||||||
}
|
}
|
||||||
+13
@@ -1,3 +1,16 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
|
open class A {
|
||||||
|
val prop: String
|
||||||
|
constructor(x1: String, x2: String = "abc") {
|
||||||
|
prop = "$x1#$x2"
|
||||||
|
}
|
||||||
|
constructor(x1: Long) {
|
||||||
|
prop = "$x1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
class B1() : A("123") {
|
class B1() : A("123") {
|
||||||
constructor(x1: Int): this() {}
|
constructor(x1: Int): this() {}
|
||||||
+8
@@ -1,3 +1,11 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
|
package aaa
|
||||||
|
|
||||||
|
fun hello() = 17
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
val h = aaa.hello()
|
val h = aaa.hello()
|
||||||
if (h != 17) {
|
if (h != 17) {
|
||||||
+11
@@ -1,3 +1,5 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
package pkg
|
package pkg
|
||||||
|
|
||||||
interface ClassA {
|
interface ClassA {
|
||||||
@@ -7,3 +9,12 @@ interface ClassA {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
|
import pkg.ClassA
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
val obj = ClassA.DEFAULT
|
||||||
|
obj.toString()
|
||||||
|
}
|
||||||
+15
@@ -1,3 +1,18 @@
|
|||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
|
package aaa
|
||||||
|
|
||||||
|
enum class E {
|
||||||
|
TRIVIAL_ENTRY,
|
||||||
|
SUBCLASS { };
|
||||||
|
|
||||||
|
class Nested {
|
||||||
|
fun fortyTwo() = 42
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
import aaa.E.*
|
import aaa.E.*
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
+62
-35
@@ -18,16 +18,16 @@ package org.jetbrains.kotlin.jvm.compiler;
|
|||||||
|
|
||||||
import com.intellij.openapi.Disposable;
|
import com.intellij.openapi.Disposable;
|
||||||
import com.intellij.openapi.util.Disposer;
|
import com.intellij.openapi.util.Disposer;
|
||||||
import com.intellij.openapi.util.io.FileUtil;
|
|
||||||
import com.intellij.util.ArrayUtil;
|
import com.intellij.util.ArrayUtil;
|
||||||
import kotlin.Pair;
|
import kotlin.Pair;
|
||||||
import kotlin.text.StringsKt;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.kotlin.cli.common.modules.ModuleBuilder;
|
import org.jetbrains.kotlin.cli.common.modules.ModuleBuilder;
|
||||||
import org.jetbrains.kotlin.cli.common.output.outputUtils.OutputUtilsKt;
|
import org.jetbrains.kotlin.cli.common.output.outputUtils.OutputUtilsKt;
|
||||||
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles;
|
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles;
|
||||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment;
|
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment;
|
||||||
import org.jetbrains.kotlin.codegen.ClassFileFactory;
|
import org.jetbrains.kotlin.codegen.ClassFileFactory;
|
||||||
|
import org.jetbrains.kotlin.codegen.CodegenTestCase;
|
||||||
import org.jetbrains.kotlin.codegen.GenerationUtils;
|
import org.jetbrains.kotlin.codegen.GenerationUtils;
|
||||||
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime;
|
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime;
|
||||||
import org.jetbrains.kotlin.config.CompilerConfiguration;
|
import org.jetbrains.kotlin.config.CompilerConfiguration;
|
||||||
@@ -36,7 +36,6 @@ import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils;
|
|||||||
import org.jetbrains.kotlin.psi.KtFile;
|
import org.jetbrains.kotlin.psi.KtFile;
|
||||||
import org.jetbrains.kotlin.test.ConfigurationKind;
|
import org.jetbrains.kotlin.test.ConfigurationKind;
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||||
import org.jetbrains.kotlin.test.TestCaseWithTmpdir;
|
|
||||||
import org.jetbrains.kotlin.test.TestJdkKind;
|
import org.jetbrains.kotlin.test.TestJdkKind;
|
||||||
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
|
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
|
||||||
|
|
||||||
@@ -47,77 +46,82 @@ import java.net.URL;
|
|||||||
import java.net.URLClassLoader;
|
import java.net.URLClassLoader;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public abstract class AbstractCompileKotlinAgainstKotlinTest extends TestCaseWithTmpdir {
|
public abstract class AbstractCompileKotlinAgainstKotlinTest extends CodegenTestCase {
|
||||||
|
private File tmpdir;
|
||||||
private File aDir;
|
private File aDir;
|
||||||
private File bDir;
|
private File bDir;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
tmpdir = KotlinTestUtils.tmpDirForTest(this);
|
||||||
aDir = new File(tmpdir, "a");
|
aDir = new File(tmpdir, "a");
|
||||||
bDir = new File(tmpdir, "b");
|
bDir = new File(tmpdir, "b");
|
||||||
KotlinTestUtils.mkdirs(aDir);
|
KotlinTestUtils.mkdirs(aDir);
|
||||||
KotlinTestUtils.mkdirs(bDir);
|
KotlinTestUtils.mkdirs(bDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doTest(@NotNull String fileName) throws Exception {
|
@Override
|
||||||
compileA(new File(fileName));
|
protected void doMultiFileTest(File file, Map<String, ModuleAndDependencies> modules, List<TestFile> files) throws Exception {
|
||||||
String fileNameB = fileName.replaceFirst("A\\.kt$", "B.kt");
|
// Note that it may be beneficial to improve this test to handle many files, compiling them successively against all previous
|
||||||
compileB(new File(fileNameB));
|
assert files.size() == 2 : "There should be exactly two files in this test";
|
||||||
invokeMain(fileNameB);
|
TestFile fileA = files.get(0);
|
||||||
|
TestFile fileB = files.get(1);
|
||||||
|
compileA(fileA.name, fileA.content);
|
||||||
|
compileB(fileB.name, fileB.content);
|
||||||
|
invokeMain(fileB.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void invokeMain(@NotNull String fileName) throws Exception {
|
private void invokeMain(@NotNull String fileName) throws Exception {
|
||||||
Method main = generatedClass(fileName).getMethod("main", String[].class);
|
String className = PackagePartClassUtils.getFilePartShortName(fileName);
|
||||||
|
Method main = createGeneratedClassLoader().loadClass(className).getMethod("main", String[].class);
|
||||||
main.invoke(null, new Object[] {ArrayUtil.EMPTY_STRING_ARRAY});
|
main.invoke(null, new Object[] {ArrayUtil.EMPTY_STRING_ARRAY});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void invokeBox(@NotNull String fileName) throws Exception {
|
private void invokeBox(@NotNull String className) throws Exception {
|
||||||
Method box = generatedClass(fileName).getMethod("box");
|
Method box = createGeneratedClassLoader().loadClass(className).getMethod("box");
|
||||||
String result = (String) box.invoke(null);
|
String result = (String) box.invoke(null);
|
||||||
assertEquals("OK", result);
|
assertEquals("OK", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private Class<?> generatedClass(@NotNull String fileName) throws Exception {
|
private URLClassLoader createGeneratedClassLoader() throws Exception {
|
||||||
URLClassLoader classLoader = new URLClassLoader(
|
return new URLClassLoader(
|
||||||
new URL[]{ bDir.toURI().toURL(), aDir.toURI().toURL() },
|
new URL[]{ bDir.toURI().toURL(), aDir.toURI().toURL() },
|
||||||
ForTestCompileRuntime.runtimeAndReflectJarClassLoader()
|
ForTestCompileRuntime.runtimeAndReflectJarClassLoader()
|
||||||
);
|
);
|
||||||
String fileLastName = new File(fileName).getName();
|
|
||||||
return classLoader.loadClass(PackagePartClassUtils.getFilePartShortName(fileLastName));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ClassFileFactory compileA(@NotNull File ktAFile) throws IOException {
|
@NotNull
|
||||||
KotlinCoreEnvironment jetCoreEnvironment = KotlinTestUtils.createEnvironmentWithMockJdkAndIdeaAnnotations(getTestRootDisposable(),
|
private ClassFileFactory compileA(@NotNull String fileName, @NotNull String content) throws IOException {
|
||||||
ConfigurationKind.ALL);
|
KotlinCoreEnvironment environment =
|
||||||
return compileKotlin(ktAFile, aDir, jetCoreEnvironment, getTestRootDisposable());
|
KotlinTestUtils.createEnvironmentWithMockJdkAndIdeaAnnotations(getTestRootDisposable(), ConfigurationKind.ALL);
|
||||||
|
return compileKotlin(fileName, content, aDir, environment, getTestRootDisposable());
|
||||||
}
|
}
|
||||||
|
|
||||||
private ClassFileFactory compileB(@NotNull File ktBFile) throws IOException {
|
@NotNull
|
||||||
|
private ClassFileFactory compileB(@NotNull String fileName, @NotNull String content) throws IOException {
|
||||||
CompilerConfiguration configurationWithADirInClasspath = KotlinTestUtils
|
CompilerConfiguration configurationWithADirInClasspath = KotlinTestUtils
|
||||||
.compilerConfigurationForTests(ConfigurationKind.ALL, TestJdkKind.MOCK_JDK, KotlinTestUtils.getAnnotationsJar(), aDir);
|
.compilerConfigurationForTests(ConfigurationKind.ALL, TestJdkKind.MOCK_JDK, KotlinTestUtils.getAnnotationsJar(), aDir);
|
||||||
|
|
||||||
KotlinCoreEnvironment environment =
|
KotlinCoreEnvironment environment =
|
||||||
KotlinCoreEnvironment.createForTests(getTestRootDisposable(), configurationWithADirInClasspath, EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
KotlinCoreEnvironment.createForTests(getTestRootDisposable(), configurationWithADirInClasspath, EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
||||||
|
|
||||||
return compileKotlin(ktBFile, bDir, environment, getTestRootDisposable());
|
return compileKotlin(fileName, content, bDir, environment, getTestRootDisposable());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
private ClassFileFactory compileKotlin(
|
private ClassFileFactory compileKotlin(
|
||||||
@NotNull File file, @NotNull File outputDir, @NotNull KotlinCoreEnvironment jetCoreEnvironment,
|
@NotNull String fileName, @NotNull String content, @NotNull File outputDir, @NotNull KotlinCoreEnvironment environment,
|
||||||
@NotNull Disposable disposable
|
@NotNull Disposable disposable
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
|
KtFile psiFile = KotlinTestUtils.createFile(fileName, content, environment.getProject());
|
||||||
|
|
||||||
String text = FileUtil.loadFile(file, true);
|
ModuleVisibilityManager.SERVICE.getInstance(environment.getProject()).addModule(new ModuleBuilder("module for test", tmpdir.getAbsolutePath(), "test"));
|
||||||
|
|
||||||
KtFile psiFile = KotlinTestUtils.createFile(file.getName(), text, jetCoreEnvironment.getProject());
|
ClassFileFactory outputFiles = GenerationUtils.compileFileGetClassFileFactoryForTest(psiFile, environment);
|
||||||
|
|
||||||
ModuleVisibilityManager.SERVICE.getInstance(jetCoreEnvironment.getProject()).addModule(new ModuleBuilder("module for test", tmpdir.getAbsolutePath(), "test"));
|
|
||||||
|
|
||||||
ClassFileFactory outputFiles = GenerationUtils.compileFileGetClassFileFactoryForTest(psiFile, jetCoreEnvironment);
|
|
||||||
|
|
||||||
OutputUtilsKt.writeAllTo(outputFiles, outputDir);
|
OutputUtilsKt.writeAllTo(outputFiles, outputDir);
|
||||||
|
|
||||||
@@ -126,15 +130,38 @@ public abstract class AbstractCompileKotlinAgainstKotlinTest extends TestCaseWit
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
protected Pair<ClassFileFactory, ClassFileFactory> doBoxTest(@NotNull String firstFileName) {
|
protected Pair<ClassFileFactory, ClassFileFactory> doBoxTest(@NotNull String firstFileName) throws Exception {
|
||||||
List<String> files = Arrays.asList(firstFileName, StringsKt.substringBeforeLast(firstFileName, "1.kt", "") + "2.kt");
|
List<TestFile> files = KotlinTestUtils.createTestFiles(
|
||||||
|
firstFileName, KotlinTestUtils.doLoadFile(new File(firstFileName)),
|
||||||
|
new KotlinTestUtils.TestFileFactory<Void, TestFile>() {
|
||||||
|
@Override
|
||||||
|
public TestFile createFile(
|
||||||
|
@Nullable Void module, @NotNull String fileName, @NotNull String text, @NotNull Map<String, String> directives
|
||||||
|
) {
|
||||||
|
return new TestFile(fileName, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Void createModule(@NotNull String name, @NotNull List<String> dependencies) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// TODO: drop this (migrate codegen/box/inline/)
|
||||||
|
if (files.size() == 1) {
|
||||||
|
TestFile firstFile = files.iterator().next();
|
||||||
|
File secondFile = new File(firstFileName.replace("1.kt", "2.kt"));
|
||||||
|
files = Arrays.asList(firstFile, new TestFile(secondFile.getName(), KotlinTestUtils.doLoadFile(secondFile)));
|
||||||
|
}
|
||||||
|
|
||||||
ClassFileFactory factory1 = null;
|
ClassFileFactory factory1 = null;
|
||||||
ClassFileFactory factory2 = null;
|
ClassFileFactory factory2 = null;
|
||||||
try {
|
try {
|
||||||
factory1 = compileA(new File(files.get(1)));
|
TestFile fileA = files.get(1);
|
||||||
factory2 = compileB(new File(files.get(0)));
|
TestFile fileB = files.get(0);
|
||||||
invokeBox(files.get(0));
|
factory1 = compileA(fileA.name, fileA.content);
|
||||||
|
factory2 = compileB(fileB.name, fileB.content);
|
||||||
|
invokeBox(PackagePartClassUtils.getFilePartShortName(new File(fileB.name).getName()));
|
||||||
}
|
}
|
||||||
catch (Throwable e) {
|
catch (Throwable e) {
|
||||||
String result = "";
|
String result = "";
|
||||||
|
|||||||
+57
-57
@@ -32,174 +32,174 @@ import java.util.regex.Pattern;
|
|||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotlinAgainstKotlinTest {
|
public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotlinAgainstKotlinTest {
|
||||||
public void testAllFilesPresentInCompileKotlinAgainstKotlin() throws Exception {
|
public void testAllFilesPresentInCompileKotlinAgainstKotlin() throws Exception {
|
||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlin"), Pattern.compile("^(.+)\\.A.kt$"), true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlin"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("AnnotationInTrait.A.kt")
|
@TestMetadata("annotationInTrait.kt")
|
||||||
public void testAnnotationInTrait() throws Exception {
|
public void testAnnotationInTrait() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/AnnotationInTrait.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/annotationInTrait.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("ClassInObject.A.kt")
|
@TestMetadata("classInObject.kt")
|
||||||
public void testClassInObject() throws Exception {
|
public void testClassInObject() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/ClassInObject.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/classInObject.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("ClassObjectInEnum.A.kt")
|
@TestMetadata("classObjectInEnum.kt")
|
||||||
public void testClassObjectInEnum() throws Exception {
|
public void testClassObjectInEnum() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/ClassObjectInEnum.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/classObjectInEnum.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("ClassObjectMember.A.kt")
|
@TestMetadata("classObjectMember.kt")
|
||||||
public void testClassObjectMember() throws Exception {
|
public void testClassObjectMember() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/ClassObjectMember.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/classObjectMember.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("ConstructorVararg.A.kt")
|
@TestMetadata("constructorVararg.kt")
|
||||||
public void testConstructorVararg() throws Exception {
|
public void testConstructorVararg() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/ConstructorVararg.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/constructorVararg.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("DefaultConstructor.A.kt")
|
@TestMetadata("defaultConstructor.kt")
|
||||||
public void testDefaultConstructor() throws Exception {
|
public void testDefaultConstructor() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/DefaultConstructor.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/defaultConstructor.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("DoublyNestedClass.A.kt")
|
@TestMetadata("doublyNestedClass.kt")
|
||||||
public void testDoublyNestedClass() throws Exception {
|
public void testDoublyNestedClass() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/DoublyNestedClass.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/doublyNestedClass.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("Enum.A.kt")
|
@TestMetadata("enum.kt")
|
||||||
public void testEnum() throws Exception {
|
public void testEnum() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/Enum.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/enum.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("ImportObject.A.kt")
|
@TestMetadata("importObject.kt")
|
||||||
public void testImportObject() throws Exception {
|
public void testImportObject() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/ImportObject.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/importObject.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("InlinedConstants.A.kt")
|
@TestMetadata("inlinedConstants.kt")
|
||||||
public void testInlinedConstants() throws Exception {
|
public void testInlinedConstants() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/InlinedConstants.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/inlinedConstants.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("InnerClassConstructor.A.kt")
|
@TestMetadata("innerClassConstructor.kt")
|
||||||
public void testInnerClassConstructor() throws Exception {
|
public void testInnerClassConstructor() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/InnerClassConstructor.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/innerClassConstructor.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("jvmField.A.kt")
|
@TestMetadata("jvmField.kt")
|
||||||
public void testJvmField() throws Exception {
|
public void testJvmField() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/jvmField.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/jvmField.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("jvmFieldInConstructor.A.kt")
|
@TestMetadata("jvmFieldInConstructor.kt")
|
||||||
public void testJvmFieldInConstructor() throws Exception {
|
public void testJvmFieldInConstructor() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/jvmFieldInConstructor.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/jvmFieldInConstructor.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("JvmNameOnAccessor.A.kt")
|
@TestMetadata("jvmNameOnAccessor.kt")
|
||||||
public void testJvmNameOnAccessor() throws Exception {
|
public void testJvmNameOnAccessor() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/JvmNameOnAccessor.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/jvmNameOnAccessor.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("KotlinPropertyAsAnnotationParameter.A.kt")
|
@TestMetadata("kotlinPropertyAsAnnotationParameter.kt")
|
||||||
public void testKotlinPropertyAsAnnotationParameter() throws Exception {
|
public void testKotlinPropertyAsAnnotationParameter() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/KotlinPropertyAsAnnotationParameter.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/kotlinPropertyAsAnnotationParameter.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("MultifileClassInlineFunctionAccessingProperty.A.kt")
|
@TestMetadata("multifileClassInlineFunctionAccessingProperty.kt")
|
||||||
public void testMultifileClassInlineFunctionAccessingProperty() throws Exception {
|
public void testMultifileClassInlineFunctionAccessingProperty() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/MultifileClassInlineFunctionAccessingProperty.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/multifileClassInlineFunctionAccessingProperty.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("NestedClass.A.kt")
|
@TestMetadata("nestedClass.kt")
|
||||||
public void testNestedClass() throws Exception {
|
public void testNestedClass() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/NestedClass.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/nestedClass.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("NestedEnum.A.kt")
|
@TestMetadata("nestedEnum.kt")
|
||||||
public void testNestedEnum() throws Exception {
|
public void testNestedEnum() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/NestedEnum.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/nestedEnum.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("NestedObject.A.kt")
|
@TestMetadata("nestedObject.kt")
|
||||||
public void testNestedObject() throws Exception {
|
public void testNestedObject() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/NestedObject.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/nestedObject.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("PlatformNames.A.kt")
|
@TestMetadata("platformNames.kt")
|
||||||
public void testPlatformNames() throws Exception {
|
public void testPlatformNames() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/PlatformNames.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/platformNames.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("PlatformStaticInObject.A.kt")
|
@TestMetadata("platformStaticInObject.kt")
|
||||||
public void testPlatformStaticInObject() throws Exception {
|
public void testPlatformStaticInObject() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/PlatformStaticInObject.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/platformStaticInObject.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("PlatformTypes.A.kt")
|
@TestMetadata("platformTypes.kt")
|
||||||
public void testPlatformTypes() throws Exception {
|
public void testPlatformTypes() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/PlatformTypes.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/platformTypes.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("PropertyReference.A.kt")
|
@TestMetadata("propertyReference.kt")
|
||||||
public void testPropertyReference() throws Exception {
|
public void testPropertyReference() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/PropertyReference.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/propertyReference.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("RecursiveGeneric.A.kt")
|
@TestMetadata("recursiveGeneric.kt")
|
||||||
public void testRecursiveGeneric() throws Exception {
|
public void testRecursiveGeneric() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/RecursiveGeneric.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/recursiveGeneric.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("SecondaryConstructors.A.kt")
|
@TestMetadata("secondaryConstructors.kt")
|
||||||
public void testSecondaryConstructors() throws Exception {
|
public void testSecondaryConstructors() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/SecondaryConstructors.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/secondaryConstructors.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("Simple.A.kt")
|
@TestMetadata("simple.kt")
|
||||||
public void testSimple() throws Exception {
|
public void testSimple() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/Simple.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/simple.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("SimpleValAnonymousObject.A.kt")
|
@TestMetadata("simpleValAnonymousObject.kt")
|
||||||
public void testSimpleValAnonymousObject() throws Exception {
|
public void testSimpleValAnonymousObject() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/SimpleValAnonymousObject.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/simpleValAnonymousObject.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("StarImportEnum.A.kt")
|
@TestMetadata("starImportEnum.kt")
|
||||||
public void testStarImportEnum() throws Exception {
|
public void testStarImportEnum() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/StarImportEnum.A.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/starImportEnum.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+48
-1
@@ -32,7 +32,54 @@ import java.util.regex.Pattern;
|
|||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
public class CompileKotlinAgainstMultifileKotlinTestGenerated extends AbstractCompileKotlinAgainstKotlinTest {
|
public class CompileKotlinAgainstMultifileKotlinTestGenerated extends AbstractCompileKotlinAgainstKotlinTest {
|
||||||
public void testAllFilesPresentInBoxMultifileClasses() throws Exception {
|
public void testAllFilesPresentInBoxMultifileClasses() throws Exception {
|
||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultifileClasses"), Pattern.compile("^(.+)\\.1.kt$"), true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultifileClasses"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("compiler/testData/codegen/boxMultifileClasses/calls")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public static class Calls extends AbstractCompileKotlinAgainstKotlinTest {
|
||||||
|
public void testAllFilesPresentInCalls() throws Exception {
|
||||||
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultifileClasses/calls"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("callFromOtherPackage.kt")
|
||||||
|
public void testCallFromOtherPackage() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/callFromOtherPackage.kt");
|
||||||
|
doBoxTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("constFromOtherPackage.kt")
|
||||||
|
public void testConstFromOtherPackage() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/constFromOtherPackage.kt");
|
||||||
|
doBoxTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("valFromOtherPackage.kt")
|
||||||
|
public void testValFromOtherPackage() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/valFromOtherPackage.kt");
|
||||||
|
doBoxTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("varFromOtherPackage.kt")
|
||||||
|
public void testVarFromOtherPackage() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/varFromOtherPackage.kt");
|
||||||
|
doBoxTest(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("compiler/testData/codegen/boxMultifileClasses/reflection")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public static class Reflection extends AbstractCompileKotlinAgainstKotlinTest {
|
||||||
|
public void testAllFilesPresentInReflection() throws Exception {
|
||||||
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultifileClasses/reflection"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("constPropertyReferenceFromMultifileClass.kt")
|
||||||
|
public void testConstPropertyReferenceFromMultifileClass() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/reflection/constPropertyReferenceFromMultifileClass.kt");
|
||||||
|
doBoxTest(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -203,8 +203,8 @@ fun main(args: Array<String>) {
|
|||||||
model("codegen/boxInline", extension = "1.kt", testMethod = "doBoxTestWithInlineCheck")
|
model("codegen/boxInline", extension = "1.kt", testMethod = "doBoxTestWithInlineCheck")
|
||||||
}
|
}
|
||||||
|
|
||||||
testClass(AbstractCompileKotlinAgainstKotlinTest::class.java, "CompileKotlinAgainstMultifileKotlinTestGenerated") {
|
testClass<AbstractCompileKotlinAgainstKotlinTest>("CompileKotlinAgainstMultifileKotlinTestGenerated") {
|
||||||
model("codegen/boxMultifileClasses", extension = "1.kt", testMethod = "doBoxTest")
|
model("codegen/boxMultifileClasses", testMethod = "doBoxTest")
|
||||||
}
|
}
|
||||||
|
|
||||||
testClass<AbstractBlackBoxCodegenTest>("BlackBoxMultiFileCodegenTestGenerated") {
|
testClass<AbstractBlackBoxCodegenTest>("BlackBoxMultiFileCodegenTestGenerated") {
|
||||||
@@ -281,7 +281,7 @@ fun main(args: Array<String>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
testClass<AbstractCompileKotlinAgainstKotlinTest>() {
|
testClass<AbstractCompileKotlinAgainstKotlinTest>() {
|
||||||
model("compileKotlinAgainstKotlin", extension = "A.kt")
|
model("compileKotlinAgainstKotlin")
|
||||||
}
|
}
|
||||||
|
|
||||||
testClass<AbstractDescriptorRendererTest>() {
|
testClass<AbstractDescriptorRendererTest>() {
|
||||||
|
|||||||
Reference in New Issue
Block a user