[FE] Make constructors of sealed classes protected instead of internal
This commit is contained in:
committed by
TeamCityServer
parent
e795c2c407
commit
f3a8fcaea6
@@ -0,0 +1,17 @@
|
||||
// ISSUE: KT-44861
|
||||
// DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
sealed class Foo() {
|
||||
class A : Foo()
|
||||
class B : Foo()
|
||||
}
|
||||
|
||||
fun Foo(kind: String = "A"): Foo = when (kind) {
|
||||
"A" -> Foo.A()
|
||||
"B" -> Foo.B()
|
||||
else -> throw Exception()
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val foo = Foo()
|
||||
}
|
||||
Reference in New Issue
Block a user