[FIR] Fix ClassCastException when rendering ACTUAL_WITHOUT_EXPECT

#KT-57320
This commit is contained in:
Kirill Rakhman
2023-03-28 17:45:58 +02:00
committed by Space Team
parent 3b09313192
commit 3b0c36da3f
14 changed files with 131 additions and 25 deletions
@@ -0,0 +1,42 @@
// !LANGUAGE: +MultiPlatformProjects
// MODULE: common
// TARGET_PLATFORM: Common
// FILE: StringValue.kt
<!NO_ACTUAL_FOR_EXPECT{JS}!>expect class StringValue<!>
<!NO_ACTUAL_FOR_EXPECT{JS}!>expect fun StringValue.plus(other: String): StringValue<!>
// MODULE: commonJS()()(common)
// TARGET_PLATFORM: JS
// FILE: StringValue.kt
actual class Strin<!NO_ACTUAL_FOR_EXPECT{JS}!>gValue(val value: String<!>)
<!NO_ACTUAL_FOR_EXPECT{JS}!>
actual fun StringValue.plus(other: String) = StringVal<!>ue(this.value + other)
// MODULE: intermediate()()(common)
// TARGET_PLATFORM: Common
// FILE: StringDemoInterface.kt
expect interface StringDemoInterface
interface KotlinXStringDemoInterface {
val value: String
}
expect fun StringDemoInterface.plusK(): String
// MODULE: js()()(common, intermediate)
// TARGET_PLATFORM: JS
// FILE: StringDemoInterface.kt
actual typealias StringDemoInterface = KotlinXStringDemoInterface
<!ACTUAL_WITHOUT_EXPECT("actual fun StringDemoInterface.plusK(): <ERROR TYPE REF: Unresolved name: value>; The following declaration is incompatible: expect fun StringDemoInterface.plusK(): String")!>actual fun StringDemoInterface.plusK() = <!RESOLUTION_TO_CLASSIFIER!>StringValue<!>(value).plus("K").<!UNRESOLVED_REFERENCE!>value<!><!>
// FILE: main.kt
class StringDemo(override val value: String) : StringDemoInterface
fun box() = StringDemo("O").plusK()
@@ -0,0 +1,42 @@
// !LANGUAGE: +MultiPlatformProjects
// MODULE: common
// TARGET_PLATFORM: Common
// FILE: StringValue.kt
expect class <!NO_ACTUAL_FOR_EXPECT{JS}!>StringValue<!>
expect fun StringValue.<!NO_ACTUAL_FOR_EXPECT{JS}!>plus<!>(other: String): StringValue
// MODULE: commonJS()()(common)
// TARGET_PLATFORM: JS
// FILE: StringValue.kt
actual class StringValue(val value: String)
actual fun StringValue.plus(other: String) = StringValue(this.value + other)
// MODULE: intermediate()()(common)
// TARGET_PLATFORM: Common
// FILE: StringDemoInterface.kt
expect interface StringDemoInterface
interface KotlinXStringDemoInterface {
val value: String
}
expect fun StringDemoInterface.plusK(): <!NO_ACTUAL_FOR_EXPECT{JS}!>String<!>
// MODULE: js()()(common, intermediate)
// TARGET_PLATFORM: JS
// FILE: StringDemoInterface.kt
actual typealias StringDemoInterface = KotlinXStringDemoInterface
actual fun StringDemoInterface.<!ACTUAL_WITHOUT_EXPECT("Actual function 'plusK'; The following declaration is incompatible because return type is different: public expect fun StringDemoInterface /* = KotlinXStringDemoInterface */.plusK(): String")!>plusK<!>() = <!RESOLUTION_TO_CLASSIFIER!>StringValue<!>(value).<!DEBUG_INFO_MISSING_UNRESOLVED!>plus<!>("K").<!DEBUG_INFO_MISSING_UNRESOLVED!>value<!>
// FILE: main.kt
class StringDemo(override val value: String) : StringDemoInterface
fun box() = StringDemo("O").plusK()