[FIR] Allow actualization of expect classes by classes with wider visibility
^KT-59355 Fixed
This commit is contained in:
committed by
Space Team
parent
583aad2350
commit
d972b78627
+49
@@ -0,0 +1,49 @@
|
||||
// IGNORE_BACKEND_K1: ANY
|
||||
// IGNORE_REASON: KT-59355 is fixed only in K2
|
||||
// IGNORE_BACKEND_K2: JS_IR
|
||||
// IGNORE_REASON: `JsName` in js.translator/testData/_commonFiles/testUtils.kt is invisible for some reason
|
||||
// IGNORE_BACKEND: WASM
|
||||
// IGNORE_REASON: wasm tests don't support IGNORE_BACKEND_K1 directive
|
||||
// LANGUAGE: +MultiPlatformProjects
|
||||
// ISSUE: KT-59355
|
||||
|
||||
// MODULE: common
|
||||
// FILE: common.kt
|
||||
internal expect open class Some() {
|
||||
protected class ProtectedNested() {
|
||||
fun foo(): String
|
||||
}
|
||||
}
|
||||
|
||||
internal class SomeInheritor : Some() {
|
||||
fun callFoo(): String {
|
||||
return ProtectedNested().foo()
|
||||
}
|
||||
}
|
||||
|
||||
internal expect open class Other() {
|
||||
fun bar(): String
|
||||
}
|
||||
|
||||
fun commonBox(): String {
|
||||
val x = SomeInheritor().callFoo()
|
||||
val y = Other().bar()
|
||||
return x + y
|
||||
}
|
||||
|
||||
// MODULE: platform-jvm()()(common)
|
||||
// FILE: main.kt
|
||||
public actual open class Some actual constructor() {
|
||||
public actual class ProtectedNested actual constructor() {
|
||||
actual fun foo(): String = "O"
|
||||
}
|
||||
}
|
||||
|
||||
public open class PlatformOther {
|
||||
fun bar(): String = "K"
|
||||
}
|
||||
|
||||
internal actual typealias Other = PlatformOther
|
||||
|
||||
fun box(): String = commonBox()
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// ISSUE: KT-59355
|
||||
|
||||
// MODULE: common
|
||||
internal expect open class Some {
|
||||
protected class ProtectedNested
|
||||
internal class InternalNested
|
||||
|
||||
public fun publicFun()
|
||||
internal fun internalFun()
|
||||
protected fun protectedFun()
|
||||
}
|
||||
|
||||
internal expect open class Other {
|
||||
protected class ProtectedNested
|
||||
internal class InternalNested
|
||||
}
|
||||
|
||||
// MODULE: platform-jvm()()(common)
|
||||
public actual open class Some { // should be allowed
|
||||
public class ProtectedNested // should be allowed
|
||||
public class InternalNested // should be allowed
|
||||
|
||||
public actual fun publicFun() {} // should be allowed
|
||||
public actual fun internalFun() {} // should be allowed
|
||||
public actual fun protectedFun() {} // should be allowed
|
||||
}
|
||||
|
||||
public open class PlatformOther { // should be allowed
|
||||
public class ProtectedNested // should be allowed
|
||||
public class InternalNested // should be allowed
|
||||
}
|
||||
|
||||
internal actual typealias Other = PlatformOther // should be allowed
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// ISSUE: KT-59355
|
||||
|
||||
// MODULE: common
|
||||
internal expect open class <!NO_ACTUAL_FOR_EXPECT!>Some<!> {
|
||||
protected class ProtectedNested
|
||||
internal class InternalNested
|
||||
|
||||
public fun publicFun()
|
||||
internal fun internalFun()
|
||||
protected fun protectedFun()
|
||||
}
|
||||
|
||||
internal expect open class <!NO_ACTUAL_FOR_EXPECT!>Other<!> {
|
||||
protected class ProtectedNested
|
||||
internal class InternalNested
|
||||
}
|
||||
|
||||
// MODULE: platform-jvm()()(common)
|
||||
<!ACTUAL_WITHOUT_EXPECT!>public<!> actual open class Some { // should be allowed
|
||||
<!ACTUAL_WITHOUT_EXPECT!>public<!> class <!ACTUAL_MISSING!>ProtectedNested<!> // should be allowed
|
||||
<!ACTUAL_WITHOUT_EXPECT!>public<!> class <!ACTUAL_MISSING!>InternalNested<!> // should be allowed
|
||||
|
||||
public actual fun publicFun() {} // should be allowed
|
||||
public actual fun internalFun() {} // should be allowed
|
||||
public actual fun protectedFun() {} // should be allowed
|
||||
}
|
||||
|
||||
public open class PlatformOther { // should be allowed
|
||||
public class ProtectedNested // should be allowed
|
||||
public class InternalNested // should be allowed
|
||||
}
|
||||
|
||||
<!ACTUAL_WITHOUT_EXPECT!>internal<!> actual typealias Other = PlatformOther // should be allowed
|
||||
|
||||
Reference in New Issue
Block a user