[FE] Prohibit inheritance of sealed classes in different module

KT-20423
This commit is contained in:
Dmitriy Novozhilov
2020-11-24 14:42:10 +03:00
committed by TeamCityServer
parent f8d6f79c17
commit 57a081c399
17 changed files with 232 additions and 0 deletions
@@ -0,0 +1,7 @@
package a
sealed class Base
sealed interface IBase
class A : Base(), IBase
@@ -0,0 +1,5 @@
// ISSUE: KT-20423
package a
class B : Base(), IBase
@@ -0,0 +1,20 @@
warning: ATTENTION!
This build uses unsafe internal compiler arguments:
-XXLanguage:+FreedomForSealedClasses
-XXLanguage:+SealedInterfaces
This mode is not recommended for production use,
as no stability/compatibility guarantees are given on
compiler or generated code. Use it at your own risk!
compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/main.kt:5:11: error: cannot access '<init>': it is internal in 'Base'
class B : Base(), IBase
^
compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/main.kt:5:11: error: inheritance of sealed classes or interfaces from different module is prohibited
class B : Base(), IBase
^
compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/main.kt:5:19: error: inheritance of sealed classes or interfaces from different module is prohibited
class B : Base(), IBase
^
COMPILATION_ERROR