[Tests] Add tests for types refinement in IDE
This commit is contained in:
committed by
Dmitry Savvinov
parent
d000341178
commit
38bcedc451
@@ -673,6 +673,11 @@ fun main(args: Array<String>) {
|
||||
model("multiModuleHighlighting/hierarchicalExpectActualMatching/", recursive = false, extension = null)
|
||||
}
|
||||
|
||||
testClass<AbstractMultiplatformAnalysisTest> {
|
||||
model("multiplatform", recursive = false, extension = null)
|
||||
model("multiplatformTypeRefinement", recursive = false, extension = null)
|
||||
}
|
||||
|
||||
testClass<AbstractQuickFixMultiModuleTest> {
|
||||
model("multiModuleQuickFix", recursive = false, extension = null)
|
||||
}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
@file:Suppress("UNUSED_PARAMETER")
|
||||
|
||||
expect open class MyCancelException : MyIllegalStateException
|
||||
|
||||
fun cancel(cause: MyCancelException) {}
|
||||
|
||||
expect open class OtherException : MyIllegalStateException
|
||||
|
||||
fun other(cause: OtherException) {}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
public expect open class MyException
|
||||
|
||||
public expect open class MyIllegalStateException : MyException
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
MODULE common { platform=[JVM, JS, Native]; root=common }
|
||||
MODULE commonLibrary { platform=[JVM, JS, Native]; root=commonLibrary }
|
||||
MODULE jvm { platform=[JVM]; root=jvm }
|
||||
MODULE jvmLibrary { platform=[JVM]; root=jvmLibrary }
|
||||
|
||||
common -> commonLibrary { kind=DEPENDENCY }
|
||||
jvmLibrary -> commonLibrary { kind=DEPENDS_ON }
|
||||
jvm -> commonLibrary, jvmLibrary { kind=DEPENDENCY }
|
||||
jvm -> common { kind=DEPENDS_ON }
|
||||
@@ -0,0 +1,9 @@
|
||||
actual typealias MyCancelException = platform.lib.MyCancellationException
|
||||
|
||||
actual open class OtherException : platform.lib.MyIllegalStateException()
|
||||
|
||||
fun test() {
|
||||
cancel(MyCancelException()) // TYPE_MISMATCH
|
||||
|
||||
other(OtherException())
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
actual typealias MyException = platform.lib.MyException
|
||||
|
||||
actual typealias MyIllegalStateException = platform.lib.MyIllegalStateException
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package platform.lib
|
||||
|
||||
open class MyException
|
||||
|
||||
open class MyIllegalStateException : MyException()
|
||||
|
||||
open class MyCancellationException : MyIllegalStateException()
|
||||
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
package sample
|
||||
|
||||
fun test_1() {
|
||||
take_A_common_1(A::common_1_A)
|
||||
take_A_alias_common_1(A::common_1_A)
|
||||
}
|
||||
|
||||
fun test_2() {
|
||||
take_B_common_1(B::common_1_A)
|
||||
take_B_alias_common_1(B::common_1_A)
|
||||
take_B_common_1(B::common_1_B)
|
||||
take_B_alias_common_1(B::common_1_B)
|
||||
}
|
||||
|
||||
fun test_3() {
|
||||
take_A_common_1(A_Common_1_Alias::common_1_A)
|
||||
take_A_alias_common_1(A_Common_1_Alias::common_1_A)
|
||||
}
|
||||
|
||||
fun test_4() {
|
||||
take_B_common_1(B_Common_1_Alias::common_1_A)
|
||||
take_B_alias_common_1(B_Common_1_Alias::common_1_A)
|
||||
take_B_common_1(B_Common_1_Alias::common_1_B)
|
||||
take_B_alias_common_1(B_Common_1_Alias::common_1_B)
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
@file:Suppress("UNUSED_PARAMETER")
|
||||
|
||||
package sample
|
||||
|
||||
expect interface A {
|
||||
fun common_1_A()
|
||||
}
|
||||
|
||||
expect interface B : A {
|
||||
fun common_1_B()
|
||||
}
|
||||
|
||||
typealias A_Common_1_Alias = A
|
||||
typealias B_Common_1_Alias = B
|
||||
|
||||
fun take_A_common_1(func: (A) -> Unit) {}
|
||||
fun take_B_common_1(func: (B) -> Unit) {}
|
||||
|
||||
fun take_A_alias_common_1(func: (A_Common_1_Alias) -> Unit) {}
|
||||
fun take_B_alias_common_1(func: (B_Common_1_Alias) -> Unit) {}
|
||||
Vendored
+94
@@ -0,0 +1,94 @@
|
||||
package sample
|
||||
|
||||
fun test_1() {
|
||||
take_A_common_1(A::common_1_A)
|
||||
take_A_alias_common_1(A::common_1_A)
|
||||
take_A_common_1(A::common_2_A)
|
||||
take_A_alias_common_1(A::common_2_A)
|
||||
take_A_common_1(C::common_2_C)
|
||||
take_A_alias_common_1(C::common_2_C)
|
||||
}
|
||||
|
||||
fun test_1_alias_1() {
|
||||
take_A_common_1(A_Common_1_Alias::common_1_A)
|
||||
take_A_alias_common_1(A_Common_1_Alias::common_1_A)
|
||||
take_A_common_1(A_Common_1_Alias::common_2_A)
|
||||
take_A_alias_common_1(A_Common_1_Alias::common_2_A)
|
||||
}
|
||||
|
||||
fun test_1_alias_2() {
|
||||
take_A_common_1(A_Common_2_Alias::common_1_A)
|
||||
take_A_alias_common_1(A_Common_2_Alias::common_1_A)
|
||||
take_A_common_1(A_Common_2_Alias::common_2_A)
|
||||
take_A_alias_common_1(A_Common_2_Alias::common_2_A)
|
||||
take_A_common_1(C_Common_2_Alias::common_2_C)
|
||||
take_A_alias_common_1(C_Common_2_Alias::common_2_C)
|
||||
}
|
||||
|
||||
fun test_2() {
|
||||
take_A_common_2(A::common_2_A)
|
||||
take_A_alias_common_2(A::common_2_A)
|
||||
take_A_common_2(A::common_2_A)
|
||||
take_A_alias_common_2(A::common_2_A)
|
||||
take_A_common_2(C::common_2_C)
|
||||
take_A_alias_common_2(C::common_2_C)
|
||||
}
|
||||
|
||||
fun test_2_alias_1() {
|
||||
take_A_common_2(A_Common_1_Alias::common_2_A)
|
||||
take_A_alias_common_2(A_Common_1_Alias::common_2_A)
|
||||
take_A_common_2(A_Common_1_Alias::common_2_A)
|
||||
take_A_alias_common_2(A_Common_1_Alias::common_2_A)
|
||||
}
|
||||
|
||||
fun test_2_alias_2() {
|
||||
take_A_common_2(A_Common_2_Alias::common_2_A)
|
||||
take_A_alias_common_2(A_Common_2_Alias::common_2_A)
|
||||
take_A_common_2(A_Common_2_Alias::common_2_A)
|
||||
take_A_alias_common_2(A_Common_2_Alias::common_2_A)
|
||||
take_A_common_2(C_Common_2_Alias::common_2_C)
|
||||
take_A_alias_common_2(C_Common_2_Alias::common_2_C)
|
||||
}
|
||||
|
||||
fun test_3() {
|
||||
take_C_common_2(C::common_2_C)
|
||||
take_C_alias_common_2(C::common_2_C)
|
||||
take_C_common_2(C_Common_2_Alias::common_2_C)
|
||||
take_C_alias_common_2(C_Common_2_Alias::common_2_C)
|
||||
}
|
||||
|
||||
fun test_4() {
|
||||
take_B_common_1(B::common_1_A)
|
||||
take_B_common_1(B::common_2_A)
|
||||
take_B_common_2(B::common_1_A)
|
||||
take_B_common_2(B::common_2_A)
|
||||
|
||||
take_B_alias_common_1(B::common_1_A)
|
||||
take_B_alias_common_1(B::common_2_A)
|
||||
take_B_alias_common_2(B::common_1_A)
|
||||
take_B_alias_common_2(B::common_2_A)
|
||||
}
|
||||
|
||||
fun test_4_alias_1() {
|
||||
take_B_common_1(B_Common_1_Alias::common_1_A)
|
||||
take_B_common_1(B_Common_1_Alias::common_2_A)
|
||||
take_B_common_2(B_Common_1_Alias::common_1_A)
|
||||
take_B_common_2(B_Common_1_Alias::common_2_A)
|
||||
|
||||
take_B_alias_common_1(B_Common_1_Alias::common_1_A)
|
||||
take_B_alias_common_1(B_Common_1_Alias::common_2_A)
|
||||
take_B_alias_common_2(B_Common_1_Alias::common_1_A)
|
||||
take_B_alias_common_2(B_Common_1_Alias::common_2_A)
|
||||
}
|
||||
|
||||
fun test_4_alias_2() {
|
||||
take_B_common_1(B_Common_2_Alias::common_1_A)
|
||||
take_B_common_1(B_Common_2_Alias::common_2_A)
|
||||
take_B_common_2(B_Common_2_Alias::common_1_A)
|
||||
take_B_common_2(B_Common_2_Alias::common_2_A)
|
||||
|
||||
take_B_alias_common_1(B_Common_2_Alias::common_1_A)
|
||||
take_B_alias_common_1(B_Common_2_Alias::common_2_A)
|
||||
take_B_alias_common_2(B_Common_2_Alias::common_1_A)
|
||||
take_B_alias_common_2(B_Common_2_Alias::common_2_A)
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
@file:Suppress("UNUSED_PARAMETER")
|
||||
|
||||
package sample
|
||||
|
||||
expect interface C {
|
||||
fun common_2_C()
|
||||
}
|
||||
|
||||
actual interface A : C {
|
||||
actual fun common_1_A()
|
||||
fun common_2_A()
|
||||
}
|
||||
|
||||
typealias A_Common_2_Alias = A
|
||||
typealias B_Common_2_Alias = B
|
||||
typealias C_Common_2_Alias = C
|
||||
|
||||
fun take_A_common_2(func: (A) -> Unit) {}
|
||||
fun take_B_common_2(func: (B) -> Unit) {}
|
||||
fun take_C_common_2(func: (C) -> Unit) {}
|
||||
|
||||
fun take_A_alias_common_2(func: (A_Common_2_Alias) -> Unit) {}
|
||||
fun take_B_alias_common_2(func: (B_Common_2_Alias) -> Unit) {}
|
||||
fun take_C_alias_common_2(func: (C_Common_2_Alias) -> Unit) {}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
MODULE common-1 { platform=[JVM, JS, Native] }
|
||||
MODULE common-1-main { platform=[JVM, JS, Native] }
|
||||
|
||||
MODULE common-2 { platform=[JVM, JS, Native] }
|
||||
MODULE common-2-main { platform=[JVM, JS, Native] }
|
||||
|
||||
MODULE jvm { platform=[JVM] }
|
||||
MODULE jvm-main { platform=[JVM] }
|
||||
|
||||
common-2 -> common-1 { kind=DEPENDS_ON }
|
||||
jvm -> common-2 { kind=DEPENDS_ON }
|
||||
|
||||
common-1-main -> common-1 { kind=DEPENDENCY }
|
||||
common-2-main -> common-2, common-1 { kind=DEPENDENCY }
|
||||
jvm-main -> jvm, common-2, common-1 { kind=DEPENDENCY }
|
||||
@@ -0,0 +1,11 @@
|
||||
This file presents modules dependency graph for the test (classes).
|
||||
Please, use monospaced font.
|
||||
|
||||
|
||||
common-1 ---- common-1-main
|
||||
|
|
||||
|
|
||||
common-2 ---- common-2-main
|
||||
|
|
||||
|
|
||||
jvm ------ jvm-main
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
package sample
|
||||
|
||||
fun test_1() {
|
||||
take_C_common_2(C::common_2_C)
|
||||
take_C_alias_common_2(C::common_2_C)
|
||||
take_C_jvm(C::common_2_C)
|
||||
take_C_alias_jvm(C::common_2_C)
|
||||
|
||||
take_C_common_2(C::jvm_C)
|
||||
take_C_alias_common_2(C::jvm_C)
|
||||
take_C_jvm(C::jvm_C)
|
||||
take_C_alias_jvm(C::jvm_C)
|
||||
}
|
||||
|
||||
fun test_1_alias_1() {
|
||||
take_C_common_2(C_Common_2_Alias::common_2_C)
|
||||
take_C_alias_common_2(C_Common_2_Alias::common_2_C)
|
||||
take_C_jvm(C_Common_2_Alias::common_2_C)
|
||||
take_C_alias_jvm(C_Common_2_Alias::common_2_C)
|
||||
|
||||
take_C_common_2(C_Common_2_Alias::jvm_C)
|
||||
take_C_alias_common_2(C_Common_2_Alias::jvm_C)
|
||||
take_C_jvm(C_Common_2_Alias::jvm_C)
|
||||
take_C_alias_jvm(C_Common_2_Alias::jvm_C)
|
||||
}
|
||||
|
||||
fun test_1_alias_2() {
|
||||
take_C_common_2(C_jvm_Alias::common_2_C)
|
||||
take_C_alias_common_2(C_jvm_Alias::common_2_C)
|
||||
take_C_jvm(C_jvm_Alias::common_2_C)
|
||||
take_C_alias_jvm(C_jvm_Alias::common_2_C)
|
||||
|
||||
take_C_common_2(C_jvm_Alias::jvm_C)
|
||||
take_C_alias_common_2(C_jvm_Alias::jvm_C)
|
||||
take_C_jvm(C_jvm_Alias::jvm_C)
|
||||
take_C_alias_jvm(C_jvm_Alias::jvm_C)
|
||||
}
|
||||
|
||||
fun test_2() {
|
||||
take_A_common_1(C::jvm_C)
|
||||
take_A_common_2(C::jvm_C)
|
||||
take_A_jvm(C::jvm_C)
|
||||
|
||||
take_A_common_1(C::common_2_C)
|
||||
take_A_common_2(C::common_2_C)
|
||||
take_A_jvm(C::common_2_C)
|
||||
}
|
||||
|
||||
fun test_2_alias_1() {
|
||||
take_A_common_1(C_Common_2_Alias::jvm_C)
|
||||
take_A_common_2(C_Common_2_Alias::jvm_C)
|
||||
take_A_jvm(C_Common_2_Alias::jvm_C)
|
||||
|
||||
take_A_common_1(C_Common_2_Alias::common_2_C)
|
||||
take_A_common_2(C_Common_2_Alias::common_2_C)
|
||||
take_A_jvm(C_Common_2_Alias::common_2_C)
|
||||
}
|
||||
|
||||
fun test_2_alias_2() {
|
||||
take_A_common_1(C_jvm_Alias::jvm_C)
|
||||
take_A_common_2(C_jvm_Alias::jvm_C)
|
||||
take_A_jvm(C_jvm_Alias::jvm_C)
|
||||
|
||||
take_A_common_1(C_jvm_Alias::common_2_C)
|
||||
take_A_common_2(C_jvm_Alias::common_2_C)
|
||||
take_A_jvm(C_jvm_Alias::common_2_C)
|
||||
}
|
||||
|
||||
fun test_3() {
|
||||
take_B_common_1(B::common_1_B)
|
||||
take_B_common_2(B::common_1_B)
|
||||
take_B_jvm(B::common_1_B)
|
||||
take_B_common_1(B::jvm_B)
|
||||
take_B_common_2(B::jvm_B)
|
||||
take_B_jvm(B::jvm_B)
|
||||
|
||||
take_B_alias_common_1(B::common_1_B)
|
||||
take_B_alias_common_2(B::common_1_B)
|
||||
take_B_alias_jvm(B::common_1_B)
|
||||
take_B_alias_common_1(B::jvm_B)
|
||||
take_B_alias_common_2(B::jvm_B)
|
||||
take_B_alias_jvm(B::jvm_B)
|
||||
}
|
||||
|
||||
fun test_3_alias_1() {
|
||||
take_B_common_1(B_Common_1_Alias::common_1_B)
|
||||
take_B_common_2(B_Common_1_Alias::common_1_B)
|
||||
take_B_jvm(B_Common_1_Alias::common_1_B)
|
||||
take_B_common_1(B_Common_1_Alias::jvm_B)
|
||||
take_B_common_2(B_Common_1_Alias::jvm_B)
|
||||
take_B_jvm(B_Common_1_Alias::jvm_B)
|
||||
|
||||
take_B_alias_common_1(B_Common_1_Alias::common_1_B)
|
||||
take_B_alias_common_2(B_Common_1_Alias::common_1_B)
|
||||
take_B_alias_jvm(B_Common_1_Alias::common_1_B)
|
||||
take_B_alias_common_1(B_Common_1_Alias::jvm_B)
|
||||
take_B_alias_common_2(B_Common_1_Alias::jvm_B)
|
||||
take_B_alias_jvm(B_Common_1_Alias::jvm_B)
|
||||
}
|
||||
|
||||
fun test_3_alias_2() {
|
||||
take_B_common_1(B_Common_2_Alias::common_1_B)
|
||||
take_B_common_2(B_Common_2_Alias::common_1_B)
|
||||
take_B_jvm(B_Common_2_Alias::common_1_B)
|
||||
take_B_common_1(B_Common_2_Alias::jvm_B)
|
||||
take_B_common_2(B_Common_2_Alias::jvm_B)
|
||||
take_B_jvm(B_Common_2_Alias::jvm_B)
|
||||
|
||||
take_B_alias_common_1(B_Common_2_Alias::common_1_B)
|
||||
take_B_alias_common_2(B_Common_2_Alias::common_1_B)
|
||||
take_B_alias_jvm(B_Common_2_Alias::common_1_B)
|
||||
take_B_alias_common_1(B_Common_2_Alias::jvm_B)
|
||||
take_B_alias_common_2(B_Common_2_Alias::jvm_B)
|
||||
take_B_alias_jvm(B_Common_2_Alias::jvm_B)
|
||||
}
|
||||
|
||||
fun test_3_alias_3() {
|
||||
take_B_common_1(B_jvm_Alias::common_1_B)
|
||||
take_B_common_2(B_jvm_Alias::common_1_B)
|
||||
take_B_jvm(B_jvm_Alias::common_1_B)
|
||||
take_B_common_1(B_jvm_Alias::jvm_B)
|
||||
take_B_common_2(B_jvm_Alias::jvm_B)
|
||||
take_B_jvm(B_jvm_Alias::jvm_B)
|
||||
|
||||
take_B_alias_common_1(B_jvm_Alias::common_1_B)
|
||||
take_B_alias_common_2(B_jvm_Alias::common_1_B)
|
||||
take_B_alias_jvm(B_jvm_Alias::common_1_B)
|
||||
take_B_alias_common_1(B_jvm_Alias::jvm_B)
|
||||
take_B_alias_common_2(B_jvm_Alias::jvm_B)
|
||||
take_B_alias_jvm(B_jvm_Alias::jvm_B)
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
@file:Suppress("UNUSED_PARAMETER")
|
||||
|
||||
package sample
|
||||
|
||||
actual interface C {
|
||||
actual fun common_2_C()
|
||||
fun jvm_C()
|
||||
}
|
||||
|
||||
actual interface B : A {
|
||||
actual fun common_1_B()
|
||||
fun jvm_B()
|
||||
}
|
||||
|
||||
typealias A_jvm_Alias = A
|
||||
typealias B_jvm_Alias = B
|
||||
typealias C_jvm_Alias = C
|
||||
|
||||
fun take_A_jvm(func: (A) -> Unit) {}
|
||||
fun take_B_jvm(func: (B) -> Unit) {}
|
||||
fun take_C_jvm(func: (C) -> Unit) {}
|
||||
|
||||
fun take_A_alias_jvm(func: (A_jvm_Alias) -> Unit) {}
|
||||
fun take_B_alias_jvm(func: (B_jvm_Alias) -> Unit) {}
|
||||
fun take_C_alias_jvm(func: (C_jvm_Alias) -> Unit) {}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
expect class A {
|
||||
fun commonMember()
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
MODULE common { platform=[JVM, JS, Native] }
|
||||
MODULE jvm { platform=[JVM] }
|
||||
|
||||
jvm -> common { kind=DEPENDS_ON }
|
||||
@@ -0,0 +1,10 @@
|
||||
actual class A {
|
||||
actual fun commonMember() { }
|
||||
|
||||
fun platformMember() { }
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A().commonMember()
|
||||
A().platformMember()
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
@file:Suppress("UNUSED_PARAMETER")
|
||||
|
||||
package sample
|
||||
|
||||
// --------------------------------------------
|
||||
|
||||
expect interface A {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
fun take_A_common_1(x: A) {
|
||||
x.foo()
|
||||
}
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
@file:Suppress("UNUSED_PARAMETER")
|
||||
|
||||
package sample
|
||||
|
||||
actual interface A {
|
||||
actual fun foo()
|
||||
fun bar()
|
||||
}
|
||||
|
||||
fun take_A_common_2_1(x: A) {
|
||||
x.foo()
|
||||
x.bar()
|
||||
}
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
@file:Suppress("UNUSED_PARAMETER")
|
||||
|
||||
package sample
|
||||
|
||||
actual interface A {
|
||||
actual fun foo()
|
||||
fun baz()
|
||||
}
|
||||
|
||||
fun take_A_common_2_2(x: A) {
|
||||
x.foo()
|
||||
x.baz()
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
MODULE common-1 { platform=[JVM, JS, Native]; root=common-1 }
|
||||
|
||||
MODULE common-2-1 { platform=[JVM]; root=common-2-1 }
|
||||
MODULE common-2-2 { platform=[JVM]; root=common-2-2 }
|
||||
|
||||
MODULE jvm { platform=[JVM]; root=jvm }
|
||||
|
||||
common-2-1 -> common-1 { kind=DEPENDS_ON }
|
||||
common-2-2 -> common-1 { kind=DEPENDS_ON }
|
||||
|
||||
jvm -> common-2-1, common-2-2 { kind=DEPENDENCY }
|
||||
|
||||
// TODO: remove closure
|
||||
jvm -> common-1 { kind=DEPENDENCY }
|
||||
@@ -0,0 +1,17 @@
|
||||
This file presents modules dependency graph for the test (classes).
|
||||
Please, use monospaced font.
|
||||
|
||||
common-1
|
||||
/ \
|
||||
/ \
|
||||
/ \
|
||||
/ \
|
||||
/ \
|
||||
common-2-1 common-2-2
|
||||
\ /
|
||||
\ /
|
||||
\ /
|
||||
\ /
|
||||
\ /
|
||||
\ /
|
||||
jvm
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package sample
|
||||
|
||||
interface B : A
|
||||
|
||||
fun testA(x: A) {
|
||||
x.foo()
|
||||
x.bar()
|
||||
x.<!UNRESOLVED_REFERENCE("baz")!>baz<!>()
|
||||
|
||||
take_A_common_1(x)
|
||||
take_A_common_2_1(x)
|
||||
take_A_common_2_2(x)
|
||||
}
|
||||
|
||||
fun testB(x: B) {
|
||||
x.foo()
|
||||
x.bar()
|
||||
x.<!UNRESOLVED_REFERENCE("baz")!>baz<!>()
|
||||
|
||||
take_A_common_1(x)
|
||||
take_A_common_2_1(x)
|
||||
take_A_common_2_2(x) // here we should have some error
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
@file:Suppress("UNUSED_PARAMETER")
|
||||
package sample
|
||||
|
||||
interface AA
|
||||
interface BB
|
||||
interface CC
|
||||
interface DD
|
||||
|
||||
expect interface A {
|
||||
fun foo_A()
|
||||
}
|
||||
|
||||
fun take0(x: A): AA = null!!
|
||||
fun take1(x: A): AA = null!!
|
||||
fun take2(x: A): AA = null!!
|
||||
fun take3(x: A): AA = null!!
|
||||
fun take4(x: A): AA = null!!
|
||||
|
||||
fun test(x: A) {
|
||||
take4(x)
|
||||
}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
@file:Suppress("UNUSED_PARAMETER")
|
||||
package sample
|
||||
|
||||
expect interface B : A {
|
||||
fun foo_B_1()
|
||||
}
|
||||
|
||||
fun take1(x: B): BB = null!!
|
||||
fun take2(x: B): BB = null!!
|
||||
fun take3(x: B): BB = null!!
|
||||
|
||||
fun getB(): B = null!!
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
@file:Suppress("UNUSED_PARAMETER")
|
||||
package sample
|
||||
|
||||
expect interface C : A {
|
||||
fun foo_C_1()
|
||||
}
|
||||
|
||||
fun take1(x: C): CC = null!!
|
||||
|
||||
fun getC(): C = null!!
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
@file:Suppress("UNUSED_PARAMETER")
|
||||
package sample
|
||||
|
||||
actual interface A {
|
||||
actual fun foo_A()
|
||||
fun foo_A_3()
|
||||
}
|
||||
|
||||
fun take0(x: A): DD = null!!
|
||||
fun take1(x: A): DD = null!!
|
||||
fun take2(x: A): DD = null!!
|
||||
fun take4(x: A): DD = null!!
|
||||
|
||||
fun test(x: A) {
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY(" public fun take4(x: A): AA defined in sample in file common-1.kt public fun take4(x: A): DD defined in sample in file common-2-3.kt")!>take4<!>(x)
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
MODULE common-1 { platform=[JVM, JS, Native] }
|
||||
|
||||
MODULE common-2-1 { platform=[JVM, JS, Native] }
|
||||
MODULE common-2-2 { platform=[JVM, JS, Native] }
|
||||
MODULE common-2-3 { platform=[JVM, JS, Native] }
|
||||
|
||||
MODULE jvm { platform=[JVM] }
|
||||
|
||||
common-2-1 -> common-1 { kind=DEPENDS_ON }
|
||||
common-2-2 -> common-1 { kind=DEPENDS_ON }
|
||||
common-2-3 -> common-1 { kind=DEPENDS_ON }
|
||||
|
||||
jvm -> common-2-1, common-2-2 { kind=DEPENDS_ON }
|
||||
jvm -> common-2-3 { kind=DEPENDS_ON }
|
||||
|
||||
jvm -> common-1 { kind=DEPENDS_ON }
|
||||
@@ -0,0 +1,25 @@
|
||||
This file presents modules dependency graph for the test (classes).
|
||||
Please, use monospaced font.
|
||||
|
||||
common-1-1
|
||||
/ | \
|
||||
/ | \
|
||||
/ | \
|
||||
/ | \
|
||||
/ | \
|
||||
/ | \
|
||||
/ | \
|
||||
/ | \
|
||||
/ | \
|
||||
common-2-1 common-2-2 common-2-2
|
||||
\ | /
|
||||
\ | /
|
||||
\ | /
|
||||
\ | /
|
||||
\ | /
|
||||
\ | /
|
||||
\ | /
|
||||
\ | /
|
||||
\ | /
|
||||
\ | /
|
||||
jvm
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
@file:Suppress("UNUSED_PARAMETER", "UNUSED_VARIABLE")
|
||||
package sample
|
||||
|
||||
interface D : A {
|
||||
fun foo_B_1()
|
||||
fun foo_B_2()
|
||||
fun foo_C_1()
|
||||
fun foo_C_2()
|
||||
fun foo_D()
|
||||
}
|
||||
|
||||
actual typealias B = D
|
||||
actual typealias C = D
|
||||
|
||||
fun take0(x: D): Unit = null!!
|
||||
|
||||
fun test_1(x: D) {
|
||||
val res0: Unit = take0(x)
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY(" public fun take1(x: A): AA defined in sample in file common-1.kt public fun take1(x: A): DD defined in sample in file common-2-3.kt public fun take1(x: B): BB defined in sample in file common-2-1.kt public fun take1(x: C): CC defined in sample in file common-2-2.kt")!>take1<!>(x)
|
||||
val res2: BB = take2(x)
|
||||
val res3: BB = take3(x)
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY(" public fun take4(x: A): AA defined in sample in file common-1.kt public fun take4(x: A): DD defined in sample in file common-2-3.kt")!>take4<!>(x)
|
||||
}
|
||||
|
||||
fun test_2() {
|
||||
val x = getB()
|
||||
x.foo_A()
|
||||
x.foo_A_3()
|
||||
x.foo_B_1()
|
||||
x.foo_B_2()
|
||||
x.foo_C_1()
|
||||
x.foo_C_2()
|
||||
x.foo_D()
|
||||
}
|
||||
|
||||
fun test_3() {
|
||||
val x = getB()
|
||||
x.foo_A()
|
||||
x.foo_A_3()
|
||||
x.foo_B_1()
|
||||
x.foo_B_2()
|
||||
x.foo_C_1()
|
||||
x.foo_C_2()
|
||||
x.foo_D()
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
expect class E {
|
||||
fun commonMember()
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
MODULE common { platform=[JVM, JS, Native]; root=common }
|
||||
MODULE jvm { platform=[JVM]; root=jvm }
|
||||
MODULE main { platform=[JVM]; root=main }
|
||||
|
||||
jvm -> common { kind=DEPENDS_ON }
|
||||
main -> jvm { kind=DEPENDS_ON }
|
||||
@@ -0,0 +1,5 @@
|
||||
actual class E {
|
||||
actual fun commonMember() {}
|
||||
|
||||
fun platformMember() {}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
fun E.test() {
|
||||
commonMember()
|
||||
platformMember()
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package sample
|
||||
|
||||
expect interface Input
|
||||
|
||||
abstract class AbstractInput : Input {
|
||||
val head: Int = null!!
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
MODULE common { platform=[JVM, JS, Native] }
|
||||
|
||||
MODULE js { platform=[JS] }
|
||||
|
||||
js -> common { kind=DEPENDS_ON }
|
||||
@@ -0,0 +1,10 @@
|
||||
package sample
|
||||
|
||||
actual interface Input
|
||||
|
||||
class JSInput : AbstractInput()
|
||||
|
||||
// ------------------------------------
|
||||
|
||||
expect class ExpectInJsActualInJs
|
||||
actual class ExpectInJsActualInJs
|
||||
@@ -0,0 +1,9 @@
|
||||
@file:Suppress("UNUSED_PARAMETER")
|
||||
|
||||
package sample
|
||||
|
||||
expect interface A
|
||||
|
||||
fun useA(block: A.() -> Unit) {}
|
||||
|
||||
fun anotherUseA(block: (A) -> Unit) {}
|
||||
@@ -0,0 +1,4 @@
|
||||
MODULE common { platform=[JVM, JS, Native] }
|
||||
MODULE jvm { platform=[JVM] }
|
||||
|
||||
jvm -> common { kind=DEPENDS_ON }
|
||||
@@ -0,0 +1,23 @@
|
||||
package sample
|
||||
|
||||
actual interface A {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
fun test() {
|
||||
useA {
|
||||
foo()
|
||||
}
|
||||
|
||||
anotherUseA {
|
||||
<!UNRESOLVED_REFERENCE("foo")!>foo<!>()
|
||||
}
|
||||
|
||||
anotherUseA {
|
||||
it.foo()
|
||||
}
|
||||
|
||||
anotherUseA { a ->
|
||||
a.foo()
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package sample
|
||||
|
||||
expect class A {
|
||||
fun commonFun()
|
||||
val x: Int
|
||||
val y: Double
|
||||
val z: String
|
||||
}
|
||||
|
||||
fun getCommonA(): A = null!!
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
MODULE common { platform=[JVM, JS, Native]; root=common }
|
||||
MODULE jvm { platform=[JVM]; root=jvm }
|
||||
MODULE main { platform=[JVM]; root=main }
|
||||
|
||||
jvm -> common { kind=DEPENDS_ON }
|
||||
jvm -> STDLIB_JVM { kind=DEPENDENCY }
|
||||
main -> jvm, common { kind=DEPENDENCY }
|
||||
@@ -0,0 +1,14 @@
|
||||
@file:Suppress("UNUSED_PARAMETER")
|
||||
|
||||
package sample
|
||||
|
||||
actual data class A(actual val x: Int, actual val y: Double, val t: String) {
|
||||
actual fun commonFun() {}
|
||||
fun platformFun() {}
|
||||
|
||||
actual val z: String by lazy { "" }
|
||||
|
||||
operator fun iterator(): Iterator<Int> = null!!
|
||||
}
|
||||
|
||||
fun testDelegate(): String = getCommonA().z
|
||||
@@ -0,0 +1,20 @@
|
||||
@file:Suppress("UNUSED_VARIABLE")
|
||||
|
||||
package sample
|
||||
|
||||
fun testDesctructing() {
|
||||
val (x, y, t) = getCommonA()
|
||||
val xx: Int = x
|
||||
val yy: Double = y
|
||||
val tt: String = t
|
||||
}
|
||||
|
||||
fun testIterator(): Int {
|
||||
var counter: Int = 0
|
||||
for (x in getCommonA()) {
|
||||
counter += x
|
||||
}
|
||||
return counter
|
||||
}
|
||||
|
||||
fun testDelegate(): String = getCommonA().z
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
@file:Suppress("UNUSED_PARAMETER")
|
||||
|
||||
package sample
|
||||
|
||||
expect interface A {
|
||||
fun common_1_A()
|
||||
}
|
||||
|
||||
expect interface B : A {
|
||||
fun common_1_B()
|
||||
}
|
||||
|
||||
fun getB(): B = null!!
|
||||
|
||||
class Out<out T>(val value: T)
|
||||
|
||||
fun takeOutA_common_1(t: Out<A>) {}
|
||||
fun takeOutB_common_1(t: Out<B>) {}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
@file:Suppress("UNUSED_PARAMETER")
|
||||
|
||||
package sample
|
||||
|
||||
expect interface A_Common {
|
||||
fun common_1_A()
|
||||
fun common_2_A()
|
||||
}
|
||||
|
||||
actual typealias A = A_Common
|
||||
|
||||
actual interface B : A {
|
||||
actual fun common_1_B()
|
||||
fun common_1_2_B()
|
||||
}
|
||||
|
||||
fun takeOutA_common_2(t: Out<A>) {}
|
||||
fun takeOutB_common_2(t: Out<B>) {}
|
||||
fun takeOutA_Common_common_2(t: Out<A_Common>) {}
|
||||
|
||||
fun getOutA(): Out<A> = null!!
|
||||
fun getOutB(): Out<B> = null!!
|
||||
fun getOutA_Common(): Out<A_Common> = null!!
|
||||
|
||||
fun test_case_2(x: B) {
|
||||
x.common_1_A()
|
||||
x.common_1_B()
|
||||
x.common_2_A()
|
||||
x.common_1_2_B()
|
||||
}
|
||||
|
||||
fun test_B() {
|
||||
val x = getB()
|
||||
x.common_1_A()
|
||||
x.common_1_B()
|
||||
x.common_2_A()
|
||||
x.common_1_2_B()
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
MODULE common-1 { platform=[JVM, JS, Native]; root=common-1 }
|
||||
MODULE common-2 { platform=[JVM, JS, Native]; root=common-2 }
|
||||
|
||||
MODULE jvm { platform=[JVM]; root=jvm }
|
||||
|
||||
common-2 -> common-1 { kind=DEPENDS_ON }
|
||||
|
||||
jvm -> common-2 { kind=DEPENDS_ON }
|
||||
@@ -0,0 +1,17 @@
|
||||
This file presents modules dependency graph for the test (classes).
|
||||
Please, use monospaced font.
|
||||
|
||||
|
||||
common-1
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
common-2
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
jvm
|
||||
@@ -0,0 +1,53 @@
|
||||
package sample
|
||||
|
||||
actual interface A_Common {
|
||||
actual fun common_1_A()
|
||||
actual fun common_2_A()
|
||||
fun jvm_A()
|
||||
}
|
||||
|
||||
interface Case_2_3 : B {
|
||||
fun jvm_Case_2_3()
|
||||
}
|
||||
|
||||
fun test_A(x: B) {
|
||||
x.common_1_A()
|
||||
x.common_1_B()
|
||||
x.common_2_A()
|
||||
x.common_1_2_B()
|
||||
x.jvm_A()
|
||||
}
|
||||
|
||||
fun test_A(x: Case_2_3) {
|
||||
x.common_1_A()
|
||||
x.common_1_B()
|
||||
x.common_2_A()
|
||||
x.common_1_2_B()
|
||||
x.jvm_A()
|
||||
x.jvm_Case_2_3()
|
||||
}
|
||||
|
||||
fun test_B() {
|
||||
val x = getB()
|
||||
x.common_1_A()
|
||||
x.common_1_B()
|
||||
x.common_2_A()
|
||||
x.common_1_2_B()
|
||||
x.jvm_A()
|
||||
}
|
||||
|
||||
fun test_case_2_3() {
|
||||
takeOutA_common_1(getOutB())
|
||||
takeOutB_common_1(getOutB())
|
||||
takeOutA_common_2(getOutB())
|
||||
takeOutB_common_2(getOutB())
|
||||
takeOutA_Common_common_2(getOutB())
|
||||
|
||||
takeOutA_common_1(getOutA())
|
||||
takeOutA_common_2(getOutA())
|
||||
takeOutA_Common_common_2(getOutA())
|
||||
|
||||
takeOutA_common_1(getOutA_Common())
|
||||
takeOutA_common_2(getOutA_Common())
|
||||
takeOutA_Common_common_2(getOutA_Common())
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
@file:Suppress("NO_ACTUAL_FOR_EXPECT")
|
||||
|
||||
package foo
|
||||
|
||||
expect interface A {
|
||||
fun commonFun()
|
||||
val b: B
|
||||
fun bFun(): B
|
||||
}
|
||||
|
||||
expect interface B {
|
||||
fun commonFunB()
|
||||
}
|
||||
|
||||
class Common {
|
||||
val a: A get() = null!!
|
||||
fun aFun(): A = null!!
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
MODULE common { platform=[JVM, JS, Native]; root=common }
|
||||
MODULE jvm { platform=[JVM]; root=jvm }
|
||||
MODULE main { platform=[JVM]; root=main }
|
||||
|
||||
jvm -> common { kind=DEPENDS_ON }
|
||||
main -> jvm { kind=DEPENDS_ON }
|
||||
@@ -0,0 +1,15 @@
|
||||
@file:Suppress("ACTUAL_WITHOUT_EXPECT")
|
||||
|
||||
package foo
|
||||
|
||||
actual interface A {
|
||||
actual fun commonFun()
|
||||
actual val b: B
|
||||
actual fun bFun(): B
|
||||
fun platformFun()
|
||||
}
|
||||
|
||||
actual interface B {
|
||||
actual fun commonFunB()
|
||||
fun platformFunB()
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package foo
|
||||
|
||||
fun test_a(a: A) {
|
||||
a.commonFun()
|
||||
a.platformFun()
|
||||
|
||||
a.b.commonFunB()
|
||||
a.b.platformFunB()
|
||||
|
||||
a.bFun().commonFunB()
|
||||
a.bFun().platformFunB()
|
||||
}
|
||||
|
||||
fun test_c(c: Common) {
|
||||
c.a.commonFun()
|
||||
c.a.platformFun()
|
||||
|
||||
c.aFun().commonFun()
|
||||
c.aFun().platformFun()
|
||||
|
||||
c.a.b.commonFunB()
|
||||
c.a.b.platformFunB()
|
||||
|
||||
c.aFun().b.commonFunB()
|
||||
c.aFun().b.platformFunB()
|
||||
|
||||
c.a.bFun().commonFunB()
|
||||
c.a.bFun().platformFunB()
|
||||
|
||||
c.aFun().bFun().commonFunB()
|
||||
c.aFun().bFun().platformFunB()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package sample
|
||||
|
||||
expect interface A<T : A<T>> {
|
||||
fun foo(): T
|
||||
}
|
||||
|
||||
interface B : A<B>
|
||||
|
||||
fun test(a: A<*>) {
|
||||
a.foo()
|
||||
a.foo().foo()
|
||||
}
|
||||
|
||||
fun test(b: B) {
|
||||
b.foo()
|
||||
b.foo().foo()
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
MODULE common { platform=[JVM, JS, Native] }
|
||||
MODULE jvm { platform=[JVM] }
|
||||
|
||||
jvm -> common { kind=DEPENDS_ON }
|
||||
@@ -0,0 +1,24 @@
|
||||
package sample
|
||||
|
||||
actual interface A<T : A<T>> {
|
||||
actual fun foo(): T
|
||||
fun bar() : T
|
||||
}
|
||||
|
||||
fun test_1(a: A<*>) {
|
||||
a.foo()
|
||||
a.bar()
|
||||
a.foo().foo()
|
||||
a.bar().bar()
|
||||
a.foo().bar()
|
||||
a.bar().foo()
|
||||
}
|
||||
|
||||
fun test_2(b: B) {
|
||||
b.foo()
|
||||
b.bar()
|
||||
b.foo().foo()
|
||||
b.bar().bar()
|
||||
b.foo().bar()
|
||||
b.bar().foo()
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
package foo
|
||||
expect class A
|
||||
@@ -0,0 +1,4 @@
|
||||
package bar
|
||||
import foo.A
|
||||
|
||||
fun baz(): A = null!!
|
||||
@@ -0,0 +1,5 @@
|
||||
package foo
|
||||
|
||||
actual class A {
|
||||
fun foo() {}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package foobar
|
||||
import bar.baz
|
||||
|
||||
fun main() {
|
||||
baz().foo()
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
MODULE d1 { platform=[JVM, JS, Native]; root=d1 }
|
||||
MODULE d2 { platform=[JVM, JS, Native]; root=d2 }
|
||||
MODULE d3 { platform=[JVM]; root=d3 }
|
||||
MODULE d4 { platform=[JVM]; root=d4 }
|
||||
|
||||
d2 -> d1 { kind=DEPENDS_ON }
|
||||
d3 -> d2 { kind=DEPENDS_ON }
|
||||
d4 -> d3 { kind=DEPENDS_ON }
|
||||
@@ -0,0 +1,5 @@
|
||||
package d0
|
||||
|
||||
interface AnotherSupertype {
|
||||
fun another()
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
@file:Suppress("NO_ACTUAL_FOR_EXPECT")
|
||||
|
||||
package foo
|
||||
|
||||
expect interface Supertype
|
||||
|
||||
class A : Supertype
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
@file:Suppress("ACTUAL_WITHOUT_EXPECT")
|
||||
|
||||
package foo
|
||||
import d0.AnotherSupertype
|
||||
|
||||
actual interface Supertype : AnotherSupertype {
|
||||
fun foo() {}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package bar
|
||||
import foo.A
|
||||
|
||||
fun baz(): A = A()
|
||||
@@ -0,0 +1,21 @@
|
||||
package foobar
|
||||
|
||||
import bar.baz
|
||||
import d0.AnotherSupertype
|
||||
|
||||
fun <T : Any> expectAnotherSupertype(x: T, y: T): T {
|
||||
x.hashCode() + y.hashCode()
|
||||
return x
|
||||
}
|
||||
|
||||
fun foo(x: AnotherSupertype) {
|
||||
x.hashCode()
|
||||
}
|
||||
|
||||
fun main(x: AnotherSupertype) {
|
||||
baz().foo()
|
||||
// TODO: support subtyping too
|
||||
foo(baz())
|
||||
|
||||
expectAnotherSupertype(x, baz()).another()
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
MODULE d0 { platform=[JVM, JS, Native]; root=d0 }
|
||||
MODULE d1 { platform=[JVM, JS, Native]; root=d1 }
|
||||
MODULE d2 { platform=[JVM, JS, Native]; root=d2 }
|
||||
MODULE d3 { platform=[JVM]; root=d3 }
|
||||
MODULE d4 { platform=[JVM]; root=d4 }
|
||||
|
||||
d2 -> d0 { kind=DEPENDS_ON }
|
||||
d3 -> d1 { kind=DEPENDS_ON }
|
||||
d4 -> d0, d1, d2, d3 { kind=DEPENDS_ON }
|
||||
|
||||
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
expect class A {
|
||||
fun commonMember()
|
||||
}
|
||||
|
||||
typealias TypealiasFromCommon = A
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
MODULE common { platform=[JVM, JS, Native] }
|
||||
MODULE jvm { platform=[JVM] }
|
||||
|
||||
jvm -> common { kind=DEPENDS_ON }
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
actual class A {
|
||||
actual fun commonMember() { }
|
||||
|
||||
fun platformMember() { }
|
||||
}
|
||||
|
||||
fun test() {
|
||||
<!RESOLUTION_TO_CLASSIFIER("TypealiasFromCommon", "EXPECT_CLASS_AS_FUNCTION", "Expected class TypealiasFromCommon does not have default constructor")!>TypealiasFromCommon<!>().<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>commonMember<!>()
|
||||
<!RESOLUTION_TO_CLASSIFIER("TypealiasFromCommon", "EXPECT_CLASS_AS_FUNCTION", "Expected class TypealiasFromCommon does not have default constructor")!>TypealiasFromCommon<!>().<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>platformwMember<!>()
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
@file:Suppress("NO_ACTUAL_FOR_EXPECT")
|
||||
|
||||
package aliases
|
||||
|
||||
expect interface A {
|
||||
fun commonFun()
|
||||
}
|
||||
|
||||
typealias A1 = A
|
||||
|
||||
expect interface B {
|
||||
fun commonFun()
|
||||
}
|
||||
|
||||
typealias B1 = B
|
||||
|
||||
class CommonInv<T>(val value: T)
|
||||
@@ -0,0 +1,6 @@
|
||||
MODULE common { platform=[JVM, JS, Native]; root=common }
|
||||
MODULE jvm { platform=[JVM]; root=jvm }
|
||||
MODULE main { platform=[JVM]; root=main }
|
||||
|
||||
jvm -> common { kind=DEPENDS_ON }
|
||||
main -> jvm { kind=DEPENDS_ON }
|
||||
@@ -0,0 +1,18 @@
|
||||
@file:Suppress("ACTUAL_WITHOUT_EXPECT")
|
||||
|
||||
package aliases
|
||||
|
||||
actual interface A {
|
||||
actual fun commonFun()
|
||||
fun platformFun()
|
||||
}
|
||||
|
||||
typealias A2 = A1
|
||||
typealias A3 = A
|
||||
|
||||
actual typealias B = A
|
||||
|
||||
typealias B2 = B
|
||||
typealias B3 = B1
|
||||
|
||||
class PlatformInv<T>(val value: T)
|
||||
@@ -0,0 +1,123 @@
|
||||
package aliases
|
||||
|
||||
fun test_1_1(a: A) {
|
||||
a.commonFun()
|
||||
a.platformFun()
|
||||
}
|
||||
|
||||
fun test_1_2(a: A1) {
|
||||
a.commonFun()
|
||||
a.platformFun()
|
||||
}
|
||||
|
||||
fun test_1_3(a: A2) {
|
||||
a.commonFun()
|
||||
a.platformFun()
|
||||
}
|
||||
|
||||
fun test_1_4(a: A3) {
|
||||
a.commonFun()
|
||||
a.platformFun()
|
||||
}
|
||||
|
||||
fun test_1_5(x: CommonInv<A>) {
|
||||
x.value.commonFun()
|
||||
x.value.platformFun()
|
||||
}
|
||||
|
||||
fun test_1_6(x: CommonInv<A1>) {
|
||||
x.value.commonFun()
|
||||
x.value.platformFun()
|
||||
}
|
||||
|
||||
fun test_1_7(x: CommonInv<A2>) {
|
||||
x.value.commonFun()
|
||||
x.value.platformFun()
|
||||
}
|
||||
|
||||
fun test_1_8(x: CommonInv<A3>) {
|
||||
x.value.commonFun()
|
||||
x.value.platformFun()
|
||||
}
|
||||
|
||||
fun test_1_9(x: PlatformInv<A>) {
|
||||
x.value.commonFun()
|
||||
x.value.platformFun()
|
||||
}
|
||||
|
||||
fun test_1_10(x: PlatformInv<A1>) {
|
||||
x.value.commonFun()
|
||||
x.value.platformFun()
|
||||
}
|
||||
|
||||
fun test_1_11(x: PlatformInv<A2>) {
|
||||
x.value.commonFun()
|
||||
x.value.platformFun()
|
||||
}
|
||||
|
||||
fun test_1_12(x: PlatformInv<A3>) {
|
||||
x.value.commonFun()
|
||||
x.value.platformFun()
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
fun test_2_1(a: B) {
|
||||
a.commonFun()
|
||||
a.platformFun()
|
||||
}
|
||||
|
||||
fun test_2_2(a: B1) {
|
||||
a.commonFun()
|
||||
a.platformFun()
|
||||
}
|
||||
|
||||
fun test_2_3(a: B2) {
|
||||
a.commonFun()
|
||||
a.platformFun()
|
||||
}
|
||||
|
||||
fun test_2_4(a: B3) {
|
||||
a.commonFun()
|
||||
a.platformFun()
|
||||
}
|
||||
|
||||
fun test_2_5(x: CommonInv<B>) {
|
||||
x.value.commonFun()
|
||||
x.value.platformFun()
|
||||
}
|
||||
|
||||
fun test_2_6(x: CommonInv<B1>) {
|
||||
x.value.commonFun()
|
||||
x.value.platformFun()
|
||||
}
|
||||
|
||||
fun test_2_7(x: CommonInv<B2>) {
|
||||
x.value.commonFun()
|
||||
x.value.platformFun()
|
||||
}
|
||||
|
||||
fun test_2_8(x: CommonInv<B3>) {
|
||||
x.value.commonFun()
|
||||
x.value.platformFun()
|
||||
}
|
||||
|
||||
fun test_2_9(x: PlatformInv<B>) {
|
||||
x.value.commonFun()
|
||||
x.value.platformFun()
|
||||
}
|
||||
|
||||
fun test_2_10(x: PlatformInv<B1>) {
|
||||
x.value.commonFun()
|
||||
x.value.platformFun()
|
||||
}
|
||||
|
||||
fun test_2_11(x: PlatformInv<B2>) {
|
||||
x.value.commonFun()
|
||||
x.value.platformFun()
|
||||
}
|
||||
|
||||
fun test_2_12(x: PlatformInv<B3>) {
|
||||
x.value.commonFun()
|
||||
x.value.platformFun()
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
@file:Suppress("NO_ACTUAL_FOR_EXPECT")
|
||||
|
||||
package foo
|
||||
|
||||
expect interface A {
|
||||
fun commonFun()
|
||||
}
|
||||
|
||||
class CommonGen<T : A> {
|
||||
val a: T get() = null!!
|
||||
}
|
||||
|
||||
class List<out T>(val value: T)
|
||||
|
||||
fun getList(): List<A> = null!!
|
||||
@@ -0,0 +1,6 @@
|
||||
MODULE common { platform=[JVM, JS, Native]; root=common }
|
||||
MODULE jvm { platform=[JVM]; root=jvm }
|
||||
MODULE main { platform=[JVM]; root=main }
|
||||
|
||||
jvm -> common { kind=DEPENDS_ON }
|
||||
main -> jvm { kind=DEPENDS_ON }
|
||||
@@ -0,0 +1,19 @@
|
||||
@file:Suppress("ACTUAL_WITHOUT_EXPECT")
|
||||
|
||||
package foo
|
||||
|
||||
interface B
|
||||
|
||||
actual interface A : B {
|
||||
actual fun commonFun()
|
||||
|
||||
fun platformFun()
|
||||
}
|
||||
|
||||
class AImpl : A {
|
||||
override fun commonFun() {}
|
||||
override fun platformFun() {}
|
||||
}
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
fun takeList(inv: List<B>) {}
|
||||
@@ -0,0 +1,30 @@
|
||||
package foo
|
||||
|
||||
fun test_1(gen: CommonGen<A>) {
|
||||
gen.a.commonFun()
|
||||
gen.a.platformFun()
|
||||
}
|
||||
|
||||
fun test_2(gen: CommonGen<AImpl>) {
|
||||
gen.a.commonFun()
|
||||
gen.a.platformFun()
|
||||
}
|
||||
|
||||
fun test_3(gen: CommonGen<*>) {
|
||||
gen.a.commonFun()
|
||||
gen.a.platformFun()
|
||||
}
|
||||
|
||||
fun test_4(gen: CommonGen<out A>) {
|
||||
gen.a.commonFun()
|
||||
gen.a.platformFun()
|
||||
}
|
||||
|
||||
fun test_5(gen: CommonGen<out AImpl>) {
|
||||
gen.a.commonFun()
|
||||
gen.a.platformFun()
|
||||
}
|
||||
|
||||
fun test_6() {
|
||||
takeList(getList())
|
||||
}
|
||||
Generated
+147
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.caches.resolve;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class MultiplatformAnalysisTestGenerated extends AbstractMultiplatformAnalysisTest {
|
||||
@TestMetadata("idea/testData/multiplatform")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Multiplatform extends AbstractMultiplatformAnalysisTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInMultiplatform() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/multiplatform"), Pattern.compile("^([^\\.]+)$"), TargetBackend.ANY, false);
|
||||
}
|
||||
|
||||
@TestMetadata("internalFromDependsOn")
|
||||
public void testInternalFromDependsOn() throws Exception {
|
||||
runTest("idea/testData/multiplatform/internalFromDependsOn/");
|
||||
}
|
||||
|
||||
@TestMetadata("internalFromDependsOnOfProduction")
|
||||
public void testInternalFromDependsOnOfProduction() throws Exception {
|
||||
runTest("idea/testData/multiplatform/internalFromDependsOnOfProduction/");
|
||||
}
|
||||
|
||||
@TestMetadata("internalFromProduction")
|
||||
public void testInternalFromProduction() throws Exception {
|
||||
runTest("idea/testData/multiplatform/internalFromProduction/");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/multiplatformTypeRefinement")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class MultiplatformTypeRefinement extends AbstractMultiplatformAnalysisTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("aliasesTypeMismatch")
|
||||
public void testAliasesTypeMismatch() throws Exception {
|
||||
runTest("idea/testData/multiplatformTypeRefinement/aliasesTypeMismatch/");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInMultiplatformTypeRefinement() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/multiplatformTypeRefinement"), Pattern.compile("^([^\\.]+)$"), TargetBackend.ANY, false);
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferences")
|
||||
public void testCallableReferences() throws Exception {
|
||||
runTest("idea/testData/multiplatformTypeRefinement/callableReferences/");
|
||||
}
|
||||
|
||||
@TestMetadata("constructorsOfExpect")
|
||||
public void testConstructorsOfExpect() throws Exception {
|
||||
runTest("idea/testData/multiplatformTypeRefinement/constructorsOfExpect/");
|
||||
}
|
||||
|
||||
@TestMetadata("diamondModuleDependency1")
|
||||
public void testDiamondModuleDependency1() throws Exception {
|
||||
runTest("idea/testData/multiplatformTypeRefinement/diamondModuleDependency1/");
|
||||
}
|
||||
|
||||
@TestMetadata("diamondModuleDependency2")
|
||||
public void testDiamondModuleDependency2() throws Exception {
|
||||
runTest("idea/testData/multiplatformTypeRefinement/diamondModuleDependency2/");
|
||||
}
|
||||
|
||||
@TestMetadata("extensionOnExpect")
|
||||
public void testExtensionOnExpect() throws Exception {
|
||||
runTest("idea/testData/multiplatformTypeRefinement/extensionOnExpect/");
|
||||
}
|
||||
|
||||
@TestMetadata("jsNameClash")
|
||||
public void testJsNameClash() throws Exception {
|
||||
runTest("idea/testData/multiplatformTypeRefinement/jsNameClash/");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdas")
|
||||
public void testLambdas() throws Exception {
|
||||
runTest("idea/testData/multiplatformTypeRefinement/lambdas/");
|
||||
}
|
||||
|
||||
@TestMetadata("languageConstructions")
|
||||
public void testLanguageConstructions() throws Exception {
|
||||
runTest("idea/testData/multiplatformTypeRefinement/languageConstructions/");
|
||||
}
|
||||
|
||||
@TestMetadata("multilevelParents")
|
||||
public void testMultilevelParents() throws Exception {
|
||||
runTest("idea/testData/multiplatformTypeRefinement/multilevelParents/");
|
||||
}
|
||||
|
||||
@TestMetadata("qualifiedReceiver")
|
||||
public void testQualifiedReceiver() throws Exception {
|
||||
runTest("idea/testData/multiplatformTypeRefinement/qualifiedReceiver/");
|
||||
}
|
||||
|
||||
@TestMetadata("recursiveTypes")
|
||||
public void testRecursiveTypes() throws Exception {
|
||||
runTest("idea/testData/multiplatformTypeRefinement/recursiveTypes/");
|
||||
}
|
||||
|
||||
@TestMetadata("simple")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("idea/testData/multiplatformTypeRefinement/simple/");
|
||||
}
|
||||
|
||||
@TestMetadata("supertypes")
|
||||
public void testSupertypes() throws Exception {
|
||||
runTest("idea/testData/multiplatformTypeRefinement/supertypes/");
|
||||
}
|
||||
|
||||
@TestMetadata("typeAliasToExpectClassExplicitReference")
|
||||
public void testTypeAliasToExpectClassExplicitReference() throws Exception {
|
||||
runTest("idea/testData/multiplatformTypeRefinement/typeAliasToExpectClassExplicitReference/");
|
||||
}
|
||||
|
||||
@TestMetadata("typeAliases")
|
||||
public void testTypeAliases() throws Exception {
|
||||
runTest("idea/testData/multiplatformTypeRefinement/typeAliases/");
|
||||
}
|
||||
|
||||
@TestMetadata("typeParameters")
|
||||
public void testTypeParameters() throws Exception {
|
||||
runTest("idea/testData/multiplatformTypeRefinement/typeParameters/");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -114,7 +114,7 @@ abstract class AbstractMultiModuleTest : DaemonAnalyzerTestCase() {
|
||||
val facetSettings = KotlinFacetSettingsProvider.getInstance(project).getInitializedSettings(this)
|
||||
facetSettings.useProjectSettings = false
|
||||
facetSettings.compilerSettings = CompilerSettings().apply {
|
||||
additionalArguments += " -Xmulti-platform"
|
||||
additionalArguments += " -Xmulti-platform -XXtype-refinement"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user