Skip to content

[AST] Name lookup shouldn't find pattern declarations later in the same condition. #12438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 14, 2017

Conversation

gregomni
Copy link
Contributor

In the code:

let x = 5
if x > 0, let x = Optional(1) { }

The name lookup of "x" in x > 0 was finding the let pattern declaration after it in the same condition, not the "x" in the previous line. This change disallows finding later patterns when looking up source locations that are earlier in the same condition.

Resolves SR-4082.
Resolves SR-4387.

@gregomni
Copy link
Contributor Author

@swift-ci Please smoke test

StmtCondition but in earlier entries. Fixes SR-4082, SR-4387.
@gregomni
Copy link
Contributor Author

Oops, forgot to add the new test. (Added/squashed)
@swift-ci Please smoke test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant