f3da26946b
In K1 analogue of `K2_VISIBILITY_ERROR` is `K1_RUNTIME_ERROR`, so
candidates with `K2_VISIBILITY_ERROR` should win over innaplicable
candidates with `INAPPLICABLE`, `INAPPLICABLE_ARGUMENTS_MAPPING_ERROR`
or `INAPPLICABLE_WRONG_RECEIVER` applicability
This is needed to allow resolution to invisible symbols (and later
suppress error with `@Suppress("INVISIBLE_SYMBOL", "INVISIBLE_REFERENCE")`
^KT-55026 Fixed
^KT-55234
42 lines
1.2 KiB
Kotlin
Vendored
42 lines
1.2 KiB
Kotlin
Vendored
// LANGUAGE: +AllowSealedInheritorsInDifferentFilesOfSamePackage
|
|
// DIAGNOSTICS: -UNUSED_PARAMETER
|
|
|
|
sealed class Case1(val x: Int) {
|
|
protected constructor(s: String) : this(s.length)
|
|
|
|
class Inheritor1 : Case1(10)
|
|
class Inheritor2 : Case1("Hello")
|
|
}
|
|
|
|
sealed class Case2 protected constructor(val x: Int) { // should be REDUNDANT_MODIFIER
|
|
protected constructor(s: String) : this(s.length)
|
|
|
|
class Inheritor1 : Case2(10)
|
|
class Inheritor2 : Case2("Hello")
|
|
}
|
|
|
|
sealed class Case3 private constructor(val x: Int) {
|
|
protected constructor(s: String) : this(s.length)
|
|
|
|
class Inheritor1 : Case3(10) // should OK
|
|
class Inheritor2 : Case3("Hello")
|
|
}
|
|
|
|
class Case3Inheritor3 : <!INVISIBLE_REFERENCE!>Case3<!>(20)
|
|
|
|
sealed class Case4 {
|
|
protected constructor(x: Int)
|
|
protected constructor(s: String) : this(s.length)
|
|
|
|
class Inheritor1 : Case4(10)
|
|
class Inheritor2 : Case4("Hello")
|
|
}
|
|
|
|
sealed class Case5() {
|
|
private constructor(x: Int) : this()
|
|
protected constructor(x: Byte) : this()
|
|
<!NON_PRIVATE_OR_PROTECTED_CONSTRUCTOR_IN_SEALED!>internal constructor(x: Short) : this()<!>
|
|
<!NON_PRIVATE_OR_PROTECTED_CONSTRUCTOR_IN_SEALED!>public constructor(x: Long) : this()<!>
|
|
constructor(x: Double) : this()
|
|
}
|