[FE 1.0] Implement deprecation warning for private constructors of sealed classes

^KT-44866
^KT-49729 Fixed
This commit is contained in:
Dmitriy Novozhilov
2021-11-16 17:21:47 +03:00
parent 93378b1a04
commit da02d25278
18 changed files with 277 additions and 4 deletions
@@ -0,0 +1,21 @@
// LANGUAGE: -UseConsistentRulesForPrivateConstructorsOfSealedClasses
// ISSUE: KT-44866, KT-49729
// FILE: base.kt
sealed class SealedBase(x: Int) {
private constructor(y: String) : this(y.length)
class SealedNested : SealedBase("nested")
}
class SealedOuter : <!RESOLUTION_TO_PRIVATE_CONSTRUCTOR_OF_SEALED_CLASS!>SealedBase<!>("outer")
abstract class RegularBase(x: Int) {
private constructor(y: String) : this(y.length)
class RegularNested : RegularBase("nested")
}
class RegularOuter : <!INVISIBLE_MEMBER!>RegularBase<!>("outer")
// FILE: derived.kt
class SealedOuterInDifferentFile : <!INVISIBLE_MEMBER, RESOLUTION_TO_PRIVATE_CONSTRUCTOR_OF_SEALED_CLASS!>SealedBase<!>("other file")