KT-44487 [Sealed Interfaces]: sealed-inheritors-provider for MPP

This commit is contained in:
Andrei Klunnyi
2021-02-09 12:54:51 +00:00
committed by Space
parent 6f9bcf249b
commit e3c1aa599d
11 changed files with 79 additions and 15 deletions
@@ -0,0 +1,7 @@
expect sealed class <!LINE_MARKER("descr='Is subclassed by CommonAImplTestClass CommonImplTestClass PlatformAXImplTestClass PlatformAYImplTestClass'")!>TestClass<!>()
class CommonImplTestClass: TestClass()
fun checkCommon(t: TestClass): Int = when (t) {
is CommonImplTestClass -> 0
}
@@ -0,0 +1 @@
class CommonAImplTestClass: <!SEALED_INHERITOR_IN_DIFFERENT_MODULE!>TestClass<!>()
@@ -0,0 +1,8 @@
MODULE common { platform=[JVM, JS, Native]; additionalCompilerArgs=: -XXLanguage:+SealedInterfaces -XXLanguage:+AllowSealedInheritorsInDifferentFilesOfSamePackage }
MODULE commonA { platform=[JVM]; additionalCompilerArgs=: -XXLanguage:+SealedInterfaces -XXLanguage:+AllowSealedInheritorsInDifferentFilesOfSamePackage }
MODULE platformAX { platform=[JVM]; additionalCompilerArgs=: -XXLanguage:+SealedInterfaces -XXLanguage:+AllowSealedInheritorsInDifferentFilesOfSamePackage }
MODULE platformAY { platform=[JVM]; additionalCompilerArgs=: -XXLanguage:+SealedInterfaces -XXLanguage:+AllowSealedInheritorsInDifferentFilesOfSamePackage }
commonA -> common { kind=DEPENDS_ON }
platformAX -> commonA { kind=DEPENDS_ON }
platformAY -> commonA { kind=DEPENDS_ON }
@@ -0,0 +1,8 @@
actual sealed class <!LINE_MARKER("descr='Is subclassed by PlatformAXImplTestClass'")!>TestClass<!> actual constructor() {}
class PlatformAXImplTestClass: TestClass()
fun checkCommonAX(t: TestClass): Int = when (t) {
is CommonImplTestClass -> 0
is CommonAImplTestClass -> 1
is PlatformAXImplTestClass -> 2
}
@@ -0,0 +1,8 @@
actual sealed class <!LINE_MARKER("descr='Is subclassed by PlatformAYImplTestClass'")!>TestClass<!> actual constructor() {}
class PlatformAYImplTestClass: TestClass()
fun checkCommonAY(t: TestClass): Int = when (t) {
is CommonImplTestClass -> 0
is CommonAImplTestClass -> 1
is PlatformAYImplTestClass -> 2
}