Add test on actual with more permissive visibility
Currently the behaviour is undesired, see KT-19664. The next commit fixes it.
This commit is contained in:
Vendored
+37
@@ -0,0 +1,37 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Container {
|
||||
fun publicFun()
|
||||
|
||||
internal fun internalFun1()
|
||||
internal fun internalFun2()
|
||||
internal fun internalFun3()
|
||||
|
||||
protected fun protectedFun1()
|
||||
protected fun protectedFun2()
|
||||
protected fun protectedFun3()
|
||||
|
||||
open internal fun openInternalFun()
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm(m1-common)
|
||||
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Container {
|
||||
actual fun publicFun() {} // OK: public -> public
|
||||
|
||||
actual fun <!ACTUAL_WITHOUT_EXPECT!>internalFun1<!>() {} // OK: internal -> public
|
||||
actual internal fun internalFun2() {} // OK: internal -> internal
|
||||
|
||||
actual fun <!ACTUAL_WITHOUT_EXPECT!>protectedFun1<!>() {} // OK: protected -> public
|
||||
actual protected fun protectedFun2() {} // OK: protected -> protected
|
||||
|
||||
actual <!ACTUAL_WITHOUT_EXPECT!>internal<!> fun protectedFun3() {} // BAD: protected -> internal
|
||||
actual <!ACTUAL_WITHOUT_EXPECT!>protected<!> fun internalFun3() {} // BAD: internal -> protected
|
||||
|
||||
actual open fun <!ACTUAL_WITHOUT_EXPECT!>openInternalFun<!>() {} // BAD: internal+open -> public
|
||||
}
|
||||
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
// -- Module: <m1-common> --
|
||||
package
|
||||
|
||||
public open expect class Container {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
internal final expect fun internalFun1(): kotlin.Unit
|
||||
internal final expect fun internalFun2(): kotlin.Unit
|
||||
internal final expect fun internalFun3(): kotlin.Unit
|
||||
internal open expect fun openInternalFun(): kotlin.Unit
|
||||
protected final expect fun protectedFun1(): kotlin.Unit
|
||||
protected final expect fun protectedFun2(): kotlin.Unit
|
||||
protected final expect fun protectedFun3(): kotlin.Unit
|
||||
public final expect fun publicFun(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
|
||||
// -- Module: <m2-jvm> --
|
||||
package
|
||||
|
||||
public open actual class Container {
|
||||
public constructor Container()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final actual fun internalFun1(): kotlin.Unit
|
||||
internal final actual fun internalFun2(): kotlin.Unit
|
||||
protected final actual fun internalFun3(): kotlin.Unit
|
||||
public open actual fun openInternalFun(): kotlin.Unit
|
||||
public final actual fun protectedFun1(): kotlin.Unit
|
||||
protected final actual fun protectedFun2(): kotlin.Unit
|
||||
internal final actual fun protectedFun3(): kotlin.Unit
|
||||
public final actual fun publicFun(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Container {
|
||||
internal fun internalFun()
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm(m1-common)
|
||||
|
||||
// FILE: foo/Foo.java
|
||||
|
||||
package foo;
|
||||
|
||||
public class Foo {
|
||||
public final void internalFun() {} // OK: internal -> public
|
||||
}
|
||||
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual typealias <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Container<!> = foo.Foo
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// -- Module: <m1-common> --
|
||||
package
|
||||
|
||||
public open expect class Container {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
internal final expect fun internalFun(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
|
||||
// -- Module: <m2-jvm> --
|
||||
package
|
||||
|
||||
public actual typealias Container = foo.Foo
|
||||
|
||||
package foo {
|
||||
|
||||
public open class Foo {
|
||||
public constructor Foo()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun internalFun(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user