[KMP] Implement ACTUAL_TYPE_ALIAS_TO_NOTHING/TO_NULLABLE_TYPE errors

^KT-60650 Done
This commit is contained in:
marat.akhin
2023-07-25 12:22:28 +02:00
committed by Space Team
parent 7cef7ac639
commit 34b271b13d
23 changed files with 249 additions and 1 deletions
@@ -0,0 +1,13 @@
// MODULE: m1-common
// FILE: common.kt
<!INCOMPATIBLE_MATCHING{JVM}!>expect class E01<!>
<!INCOMPATIBLE_MATCHING{JVM}!>expect class E02<!>
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
typealias MyNothing = Nothing
<!ACTUAL_TYPE_ALIAS_TO_NOTHING!>actual typealias E01 = Nothing<!>
<!ACTUAL_TYPE_ALIAS_NOT_TO_CLASS!>actual typealias E02 = MyNothing<!>
@@ -0,0 +1,13 @@
// MODULE: m1-common
// FILE: common.kt
expect class E01
expect class E02
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
typealias MyNothing = Nothing
<!ACTUAL_TYPE_ALIAS_TO_NOTHING!>actual typealias E01 = Nothing<!>
<!ACTUAL_TYPE_ALIAS_NOT_TO_CLASS!>actual typealias E02 = MyNothing<!>
@@ -0,0 +1,14 @@
// FIR_IDENTICAL
// MODULE: m1-common
// FILE: common.kt
expect class E01
expect class E02
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
typealias MyNullable = String?
<!ACTUAL_TYPE_ALIAS_TO_NULLABLE_TYPE!>actual typealias E01 = String?<!>
<!ACTUAL_TYPE_ALIAS_NOT_TO_CLASS!>actual typealias E02 = MyNullable<!>
@@ -0,0 +1,2 @@
expect class E01
expect class E02
@@ -0,0 +1,4 @@
typealias MyNothing = Nothing
actual typealias E01 = Nothing
actual typealias E02 = MyNothing
@@ -0,0 +1,13 @@
-- Common --
Exit code: OK
Output:
-- JVM --
Exit code: COMPILATION_ERROR
Output:
compiler/testData/multiplatform/implTypeAlias/actualTypealiasToNothing/jvm.kt:3:1: error: right-hand side of actual type alias cannot be of type kotlin.Nothing
actual typealias E01 = Nothing
^
compiler/testData/multiplatform/implTypeAlias/actualTypealiasToNothing/jvm.kt:4:1: error: right-hand side of actual type alias should be a class, not another type alias
actual typealias E02 = MyNothing
^
@@ -0,0 +1,2 @@
expect class E01
expect class E02
@@ -0,0 +1,4 @@
typealias MyNullable = String?
actual typealias E01 = String?
actual typealias E02 = MyNullable
@@ -0,0 +1,13 @@
-- Common --
Exit code: OK
Output:
-- JVM --
Exit code: COMPILATION_ERROR
Output:
compiler/testData/multiplatform/implTypeAlias/actualTypealiasToNullableType/jvm.kt:3:1: error: right-hand side of actual type alias cannot be a nullable type
actual typealias E01 = String?
^
compiler/testData/multiplatform/implTypeAlias/actualTypealiasToNullableType/jvm.kt:4:1: error: right-hand side of actual type alias should be a class, not another type alias
actual typealias E02 = MyNullable
^