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