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.
39 lines
599 B
Kotlin
Vendored
39 lines
599 B
Kotlin
Vendored
class Some {
|
|
var a : Int
|
|
<caret>
|
|
}
|
|
|
|
// EXIST: abstract
|
|
// EXIST: annotation
|
|
// EXIST: by
|
|
// EXIST: class
|
|
// EXIST: enum
|
|
// EXIST: final
|
|
// EXIST: fun
|
|
// EXIST: get
|
|
// EXIST: in
|
|
/*why?*/
|
|
// EXIST: inner
|
|
// EXIST: internal
|
|
// EXIST: object
|
|
// EXIST: open
|
|
// EXIST: out
|
|
/*why?*/
|
|
// EXIST: reified
|
|
/*why?*/
|
|
// EXIST: override
|
|
// EXIST: private
|
|
// EXIST: protected
|
|
// EXIST: public
|
|
// EXIST: set
|
|
// EXIST: interface
|
|
// EXIST: val
|
|
// EXIST: var
|
|
// EXIST: vararg
|
|
/*why?*/
|
|
// EXIST: constructor
|
|
// EXIST: init
|
|
// EXIST: companion object
|
|
// EXIST: sealed
|
|
// NOTHING_ELSE
|