8d25c20169
Sealed classes can be derived only by their own inner classes or objects. Their constructors cannot be called explicitly, so compiler knows all their descendants. Incompatible modifier checks (final, abstract). Impossible with interface, object, enum. A pack of tests provided.
4 lines
81 B
Kotlin
Vendored
4 lines
81 B
Kotlin
Vendored
sealed class Base {
|
|
fun foo() = <!SEALED_CLASS_CONSTRUCTOR_CALL!>Base()<!>
|
|
}
|