mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CS] Set the naming pattern in markInvalid
This normally gets populated by successful type-checking, we still want to populate it if we fail though to avoid attempting to type-check the parent statement again.
This commit is contained in:
@@ -307,6 +307,12 @@ void SyntacticElementTarget::markInvalid() const {
|
||||
|
||||
PreWalkResult<Pattern *> walkToPatternPre(Pattern *P) override {
|
||||
P->setType(ErrorType::get(Ctx));
|
||||
|
||||
// For a named pattern, set it on the variable. This stops us from
|
||||
// attempting to double-type-check variables we've already type-checked.
|
||||
if (auto *NP = dyn_cast<NamedPattern>(P))
|
||||
NP->getDecl()->setNamingPattern(NP);
|
||||
|
||||
return Action::Continue(P);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user