[FE] Allow declare sealed class inheritors as inner or nested classes
#KT-13495
This commit is contained in:
committed by
TeamCityServer
parent
f5f1984a60
commit
70c61be1ef
@@ -18,6 +18,12 @@ class Container {
|
||||
class C : <!HIDDEN, SEALED_SUPERTYPE!>Base<!>()
|
||||
|
||||
inner class D : <!HIDDEN, SEALED_SUPERTYPE!>Base<!>()
|
||||
|
||||
val anon = object : <!HIDDEN, SEALED_SUPERTYPE_IN_LOCAL_CLASS!>Base<!>() {} // Should be an error
|
||||
|
||||
fun someFun() {
|
||||
class LocalClass : <!HIDDEN, SEALED_SUPERTYPE_IN_LOCAL_CLASS!>Base<!>() {} // Should be an error
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: d.kt
|
||||
@@ -26,5 +32,7 @@ fun test(base: Base) {
|
||||
val x = when (base) {
|
||||
is Base.A -> 1
|
||||
is B -> 2
|
||||
is Container.C -> 3
|
||||
is Container.D -> 4
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,9 +15,15 @@ class B : Base()
|
||||
// FILE: c.kt
|
||||
|
||||
class Container {
|
||||
class C : <!SEALED_SUPERTYPE!>Base<!>()
|
||||
class C : Base()
|
||||
|
||||
inner class D : <!SEALED_SUPERTYPE!>Base<!>()
|
||||
inner class D : Base()
|
||||
|
||||
val anon = object : <!SEALED_SUPERTYPE!>Base<!>() {} // Should be an error
|
||||
|
||||
fun someFun() {
|
||||
class LocalClass : <!SEALED_SUPERTYPE!>Base<!>() {} // Should be an error
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: d.kt
|
||||
@@ -26,5 +32,7 @@ fun test(base: Base) {
|
||||
val x = when (base) {
|
||||
is Base.A -> 1
|
||||
is B -> 2
|
||||
is Container.C -> 3
|
||||
is Container.D -> 4
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,10 @@ public sealed class Base {
|
||||
|
||||
public final class Container {
|
||||
public constructor Container()
|
||||
public final val anon: Base
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun someFun(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public final class C : Base {
|
||||
|
||||
Reference in New Issue
Block a user