[FE] Make constructors of sealed classes protected instead of internal

This commit is contained in:
Dmitriy Novozhilov
2021-02-11 10:41:07 +03:00
committed by TeamCityServer
parent e795c2c407
commit f3a8fcaea6
80 changed files with 167 additions and 97 deletions
+17
View File
@@ -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()
}