Skip to content
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

Remove The Parser Hack For If-Let #31760

Merged
merged 2 commits into from May 14, 2020
Merged

Remove The Parser Hack For If-Let #31760

merged 2 commits into from May 14, 2020

Conversation

CodaFi
Copy link
Member

@CodaFi CodaFi commented May 13, 2020

The parser used to rewrite

if let x: T

into

if let x: T?

This transformation is correct at face value, but relied on being able
to construct TypeReprs with bogus source locations. Instead of having
the parser kick semantic analysis into shape, let's perform this
reinterpretation when we resolve if-let patterns in statement
conditions.

@CodaFi CodaFi requested a review from akyrtzi May 13, 2020 18:21
@CodaFi
Copy link
Member Author

CodaFi commented May 13, 2020

@swift-ci test

@CodaFi
Copy link
Member Author

CodaFi commented May 13, 2020

@swift-ci test source compatibility

Copy link
Member

@akyrtzi akyrtzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! 🙇🏻‍♂️

@CodaFi
Copy link
Member Author

CodaFi commented May 13, 2020

@swift-ci test source compatibility release

@CodaFi
Copy link
Member Author

CodaFi commented May 13, 2020

Hm... so this is source breaking because we didn't catch

 if let _ = b ?? b {}

where b : Any before. Let's hope it passes source compat, because missing the error is a hole.

@CodaFi
Copy link
Member Author

CodaFi commented May 13, 2020

@swift-ci test source compatibility release

The parser used to rewrite

if let x: T

into

if let x: T?

This transformation is correct at face value, but relied on being able
to construct TypeReprs with bogus source locations. Instead of having
the parser kick semantic analysis into shape, let's perform this
reinterpretation when we resolve if-let patterns in statement
conditions.
Now that the parser no longer constructs invalid TypeReprs for if-lets,
printing the annotation here will always reflect what the user actually
wrote.

rdar://62894516
@swift-ci
Copy link
Collaborator

Build failed
Swift Test OS X Platform
Git Sha - f68cecd1f06b6a1e4f3183b8cb905d65ed666204

@swift-ci
Copy link
Collaborator

Build failed
Swift Test Linux Platform
Git Sha - f68cecd1f06b6a1e4f3183b8cb905d65ed666204

@CodaFi
Copy link
Member Author

CodaFi commented May 13, 2020

@swift-ci smoke test

@CodaFi
Copy link
Member Author

CodaFi commented May 13, 2020

@swift-ci test Windows

@CodaFi
Copy link
Member Author

CodaFi commented May 14, 2020

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.

None yet

4 participants