[FIR] Properly report SEALED_INHERITOR_IN_DIFFERENT_MODULE

^KT-46031 Fixed
^KT-59804 Fixed
This commit is contained in:
Dmitriy Novozhilov
2023-08-30 16:52:34 +03:00
committed by Space Team
parent 387898056a
commit de68ec7cd5
7 changed files with 79 additions and 3 deletions
@@ -0,0 +1,29 @@
// LANGUAGE: +MultiPlatformProjects
// ISSUE: KT-46031
// MODULE: common-a
// TARGET_PLATFORM: Common
expect sealed class Base()
class A : Base() // OK, A in same module with Base
// MODULE: common-b()()(common-a)
// TARGET_PLATFORM: Common
class B : Base() // OK, B inherits `expect` class, not `actual`
// MODULE: common-c()()(common-b)
// TARGET_PLATFORM: Common
actual sealed class Base actual constructor()
class C : Base() // OK, C in same module with actual Base
// MODULE: common-d()()(common-c)
// TARGET_PLATFORM: Common
class D : <!SEALED_INHERITOR_IN_DIFFERENT_MODULE!>Base<!>() // Error, D not in same module with actual Base
// MODULE: jvm()()(common-d)
// TARGET_PLATFORM: JVM
class E : <!SEALED_INHERITOR_IN_DIFFERENT_MODULE!>Base<!>() // Error, E not in same module with actual Base
@@ -0,0 +1,29 @@
// LANGUAGE: +MultiPlatformProjects
// ISSUE: KT-46031
// MODULE: common-a
// TARGET_PLATFORM: Common
expect sealed <!EXPECT_AND_ACTUAL_IN_THE_SAME_MODULE{COMMON}, EXPECT_AND_ACTUAL_IN_THE_SAME_MODULE{COMMON}!>class Base<!>()
class A : Base() // OK, A in same module with Base
// MODULE: common-b()()(common-a)
// TARGET_PLATFORM: Common
class B : Base() // OK, B inherits `expect` class, not `actual`
// MODULE: common-c()()(common-b)
// TARGET_PLATFORM: Common
actual sealed <!EXPECT_AND_ACTUAL_IN_THE_SAME_MODULE, EXPECT_AND_ACTUAL_IN_THE_SAME_MODULE{COMMON}!>class Base<!> actual constructor()
class C : Base() // OK, C in same module with actual Base
// MODULE: common-d()()(common-c)
// TARGET_PLATFORM: Common
class D : <!SEALED_INHERITOR_IN_DIFFERENT_MODULE!>Base<!>() // Error, D not in same module with actual Base
// MODULE: jvm()()(common-d)
// TARGET_PLATFORM: JVM
class E : <!SEALED_INHERITOR_IN_DIFFERENT_MODULE!>Base<!>() // Error, E not in same module with actual Base
@@ -12,7 +12,7 @@ expect sealed class SealedWithPlatformActuals : SealedWithSharedActual
package foo
actual sealed class SealedWithSharedActual
class SimpleShared : <!SEALED_INHERITOR_IN_DIFFERENT_MODULE, UNRESOLVED_REFERENCE!>SealedWithPlatformActuals<!>()
class SimpleShared : <!UNRESOLVED_REFERENCE!>SealedWithPlatformActuals<!>()
// MODULE: main()()(intermediate)
// TARGET_PLATFORM: JVM