Commit Graph

1 Commits

Author SHA1 Message Date
Erik Eckstein
c452e4cc13 DefiniteInitialization: correctly handle implicit closures.
Correctly handle implicit closures in initializers, e.g. with boolean operators:

init() {
  bool_member1 = false
  bool_member2 = false || bool_member1 // implicit closure
}

The implicit closure ('bool_member1' at the RHS of the || operator) captures the whole self, but only uses 'bool_member1'.
If the whole captured 'self' is considered as use, we would get a "'self.bool_member2' not initialized" error at the partial_apply.
Therefore look into the body of the closure and only add the actually used members.

rdar://66420045
2021-01-07 23:46:50 +01:00