Commit Graph

1 Commits

Author SHA1 Message Date
Alex Hoppen
7e2898c4e4 [CodeComplete] Fix cyclic dependency error during code completion
In the added test case, we were hitting a cyclic dependency error in the request evaluator during code completion, that’s caued as follows:
– To complete at `#^COMPLETE^#`, we need to get the `NamingPattern` of `start`.
– Retrieving the `NamingPattern` of `start` causes the entire `if`-condition to be type checked, including `end`
– Type checking `end` requires getting the `NamingPattern` of `start`
=> Cyclic dependency

To resolve the issue, I added a special case to `NamingPatternRequest` that only type-checks the `StmtConditionElement` that actually defines the `VarDecl`.

Fixes rdar://75200217
2021-03-25 22:13:52 +01:00