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.
44 lines
594 B
Kotlin
Vendored
44 lines
594 B
Kotlin
Vendored
fun foo() {
|
|
bar()
|
|
}
|
|
|
|
fun bar() {
|
|
foo()
|
|
}
|
|
|
|
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: companion object
|
|
// EXIST: sealed
|
|
/*TODO*/
|
|
// NOTHING_ELSE
|