MUST_BE_INITIALIZED: take into account containingDeclaration's modality
^KT-58587 Fixed Review: https://jetbrains.team/p/kt/reviews/10136 This commit is important in scope of KT-57553. It makes the migration more smooth. Other related tests: - testUninitializedOrReassignedVariables - testAugmentedAssignmentInInitializer
This commit is contained in:
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// !LANGUAGE:-TakeIntoAccountEffectivelyFinalInMustBeInitializedCheck
|
||||
open class Base {
|
||||
open var x: String = ""
|
||||
}
|
||||
|
||||
class Foo : Base() {
|
||||
override var x: String
|
||||
|
||||
init {
|
||||
x = ""
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// !LANGUAGE:-TakeIntoAccountEffectivelyFinalInMustBeInitializedCheck
|
||||
open class Base {
|
||||
open var x: String = ""
|
||||
}
|
||||
|
||||
class Foo : Base() {
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>override var x: String<!>
|
||||
|
||||
init {
|
||||
x = ""
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE:+TakeIntoAccountEffectivelyFinalInMustBeInitializedCheck
|
||||
open class Base {
|
||||
open var x: String = ""
|
||||
}
|
||||
|
||||
class Foo : Base() {
|
||||
override var x: String
|
||||
|
||||
init {
|
||||
x = ""
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user