Remove redundant check for a variable being initialized after write
It's anyway is obvious for write instruction, while effectively after optimizations we treat val with syntactic initializer uninitialized until their immediate initiazer
This commit is contained in:
@@ -500,9 +500,7 @@ class ControlFlowInformationProvider private constructor(
|
||||
// is not declared
|
||||
enterInitState?.isDeclared != true && exitInitState?.isDeclared != true &&
|
||||
// wasn't initialized before current instruction
|
||||
enterInitState?.mayBeInitialized() != true &&
|
||||
// became initialized after current instruction
|
||||
exitInitState?.mayBeInitialized() == true
|
||||
enterInitState?.mayBeInitialized() != true
|
||||
|
||||
private fun checkInitializationForCustomSetter(ctxt: VariableInitContext, expression: KtExpression): Boolean {
|
||||
val variableDescriptor = ctxt.variableDescriptor
|
||||
|
||||
@@ -4,7 +4,7 @@ package kt897
|
||||
|
||||
class A() {
|
||||
init {
|
||||
i = 11
|
||||
<!INITIALIZATION_BEFORE_DECLARATION!>i<!> = 11
|
||||
}
|
||||
val i : Int? = null // must be an error
|
||||
|
||||
|
||||
Reference in New Issue
Block a user