Support header/impl enum classes
- prohibit constructors for header enum classes - prohibit bodies for header enum entries - all entries from header enum must be present in impl enum
This commit is contained in:
+3
@@ -0,0 +1,3 @@
|
||||
header enum class AB { A, B }
|
||||
|
||||
header enum class CD { C, D }
|
||||
@@ -0,0 +1,3 @@
|
||||
impl enum class AB { A, C }
|
||||
|
||||
impl enum class CD { C }
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
-- Common --
|
||||
Exit code: OK
|
||||
Output:
|
||||
|
||||
-- JVM --
|
||||
Exit code: COMPILATION_ERROR
|
||||
Output:
|
||||
compiler/testData/multiplatform/classScopes/enumsWithDifferentEntries/common.kt:1:19: error: header declaration 'AB' has no implementation in module
|
||||
The following declaration is incompatible because some entries from header enum are missing in the impl enum:
|
||||
public final impl enum class AB : Enum<AB>
|
||||
|
||||
header enum class AB { A, B }
|
||||
^
|
||||
compiler/testData/multiplatform/classScopes/enumsWithDifferentEntries/common.kt:3:19: error: header declaration 'CD' has no implementation in module
|
||||
The following declaration is incompatible because some entries from header enum are missing in the impl enum:
|
||||
public final impl enum class CD : Enum<CD>
|
||||
|
||||
header enum class CD { C, D }
|
||||
^
|
||||
compiler/testData/multiplatform/classScopes/enumsWithDifferentEntries/jvm.kt:1:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
|
||||
impl enum class AB { A, C }
|
||||
^
|
||||
compiler/testData/multiplatform/classScopes/enumsWithDifferentEntries/jvm.kt:3:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
|
||||
impl enum class CD { C }
|
||||
^
|
||||
|
||||
Reference in New Issue
Block a user