Add test on using correct builtins in MPP
Note that Native built-ins are not resolved correctly in this module (CPointed and similar). This is not a bug, but rather a technical limitation of the current testing infrastructure: we can't depend on kotlin-native stdlib in "big-Kotlin" repo, and native stdlib is used as the only one source of Native built-ins.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
import kotlin.<!UNRESOLVED_REFERENCE("browser")!>browser<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>window<!>
|
||||
import <!UNRESOLVED_REFERENCE("kotlinx")!>kotlinx<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>cinterop<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>CPointed<!>
|
||||
|
||||
fun jvmSpecific() {
|
||||
val x: <!UNRESOLVED_REFERENCE("Cloneable")!>Cloneable<!>? = null
|
||||
}
|
||||
|
||||
fun nativeSpecific() {
|
||||
val x: <!UNRESOLVED_REFERENCE("CPointed")!>CPointed<!>? = null
|
||||
}
|
||||
|
||||
fun jsSpecific() {
|
||||
val windowClosed = <!UNRESOLVED_REFERENCE("window")!>window<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>closed<!>
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
MODULE common { platform=[JS, JVM, Native] }
|
||||
MODULE js { platform=[JS] }
|
||||
MODULE jvmNoSdk { platform=[JVM] }
|
||||
MODULE jvmWithSdk { platform=[JVM] }
|
||||
MODULE native { platform=[Native] }
|
||||
|
||||
common -> STDLIB_COMMON { kind=DEPENDENCY }
|
||||
|
||||
js -> common { kind=DEPENDS_ON }
|
||||
js -> STDLIB_JS { kind=DEPENDENCY }
|
||||
|
||||
jvmNoSdk -> common { kind=DEPENDS_ON }
|
||||
jvmNoSdk -> STDLIB_JVM { kind=DEPENDENCY }
|
||||
|
||||
jvmWithSdk -> common { kind=DEPENDS_ON }
|
||||
jvmWithSdk -> STDLIB_JVM { kind=DEPENDENCY }
|
||||
jvmWithSdk -> FULL_JDK { kind=DEPENDENCY }
|
||||
|
||||
native -> common { kind=DEPENDS_ON }
|
||||
@@ -0,0 +1,16 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
import kotlin.browser.window
|
||||
import <!UNRESOLVED_REFERENCE("kotlinx")!>kotlinx<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>cinterop<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>CPointed<!>
|
||||
|
||||
fun jvmSpecific() {
|
||||
val x: <!UNRESOLVED_REFERENCE("Cloneable")!>Cloneable<!>? = null
|
||||
}
|
||||
|
||||
fun nativeSpecific() {
|
||||
val x: <!UNRESOLVED_REFERENCE("CPointed")!>CPointed<!>? = null
|
||||
}
|
||||
|
||||
fun jsSpecific() {
|
||||
val windowClosed = window.closed
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
//import kotlin.browser.window
|
||||
//import kotlinx.cinterop.CPointed
|
||||
//
|
||||
fun jvmSpecific() {
|
||||
val x: Cloneable? = null
|
||||
}
|
||||
|
||||
//fun nativeSpecific() {
|
||||
// val x: CPointed? = null
|
||||
//}
|
||||
//
|
||||
//fun jsSpecific() {
|
||||
// val windowClosed = window.closed
|
||||
//}
|
||||
@@ -0,0 +1,16 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
import kotlin.<!UNRESOLVED_REFERENCE("browser")!>browser<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>window<!>
|
||||
import <!UNRESOLVED_REFERENCE("kotlinx")!>kotlinx<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>cinterop<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>CPointed<!>
|
||||
|
||||
fun jvmSpecific() {
|
||||
val x: Cloneable? = null
|
||||
}
|
||||
|
||||
fun nativeSpecific() {
|
||||
val x: <!UNRESOLVED_REFERENCE("CPointed")!>CPointed<!>? = null
|
||||
}
|
||||
|
||||
fun jsSpecific() {
|
||||
val windowClosed = <!UNRESOLVED_REFERENCE("window")!>window<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>closed<!>
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
import kotlin.<!UNRESOLVED_REFERENCE("browser")!>browser<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>window<!>
|
||||
import <!UNRESOLVED_REFERENCE("kotlinx")!>kotlinx<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>cinterop<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>CPointed<!>
|
||||
|
||||
fun jvmSpecific() {
|
||||
val x: <!UNRESOLVED_REFERENCE("Cloneable")!>Cloneable<!>? = null
|
||||
}
|
||||
|
||||
fun nativeSpecific() {
|
||||
val x: <!UNRESOLVED_REFERENCE("CPointed")!>CPointed<!>? = null
|
||||
}
|
||||
|
||||
fun jsSpecific() {
|
||||
val windowClosed = <!UNRESOLVED_REFERENCE("window")!>window<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>closed<!>
|
||||
}
|
||||
Generated
+6
-2
@@ -45,6 +45,11 @@ public class MultiplatformAnalysisTestGenerated extends AbstractMultiplatformAna
|
||||
public void testInternalFromProduction() throws Exception {
|
||||
runTest("idea/testData/multiplatform/internalFromProduction/");
|
||||
}
|
||||
|
||||
@TestMetadata("useCorrectBuiltIns")
|
||||
public void testUseCorrectBuiltIns() throws Exception {
|
||||
runTest("idea/testData/multiplatform/useCorrectBuiltIns/");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/multiplatformTypeRefinement")
|
||||
@@ -61,8 +66,7 @@ public class MultiplatformAnalysisTestGenerated extends AbstractMultiplatformAna
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInMultiplatformTypeRefinement() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/multiplatformTypeRefinement"),
|
||||
Pattern.compile("^([^\\.]+)$"), TargetBackend.ANY, false);
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/multiplatformTypeRefinement"), Pattern.compile("^([^\\.]+)$"), TargetBackend.ANY, false);
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferences")
|
||||
|
||||
Reference in New Issue
Block a user