Rollup merge of #141275 - dianne:gather-guard-pat-locals-once, r=compiler-errors

`gather_locals`: only visit guard pattern guards when checking the guard

When checking a pattern with guards in it, `GatherLocalsVisitor` will visit both the pattern (when type-checking the let, arm, or param containing it) and local declarations in the guard expression (when checking the guard itself). This keeps it from visiting the guard when visiting the pattern, since otherwise it would gather locals from the guard twice, which would lead to a delayed bug: "evaluated expression more than once".

Tracking issue for guard patterns: #129967
This commit is contained in:
Matthias Krüger 2025-05-20 16:50:41 +02:00 committed by GitHub
commit 5b4115f059
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

Diff Content Not Available