Skip to content

Remove special handling of __FILE__, __LINE__, etc. #62506

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
Dec 11, 2022

Conversation

DougGregor
Copy link
Member

These were replaced by #file, #line, etc. with SE-0028, prior to Swift 3. We don't need this custom error message any more, and they shouldn't be keywords. Stop treating them as keywords in the lexer.

These were replaced by `#file`, `#line`, etc. with SE-0028, prior to
Swift 3. We don't need this custom error message any more, and they
shouldn't be keywords. Stop treating them as keywords in the lexer.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test and merge

@swift-ci swift-ci merged commit bf84d8d into swiftlang:main Dec 11, 2022
@AnthonyLatsis
Copy link
Collaborator

AnthonyLatsis commented Dec 11, 2022

@DougGregor Why are we sacrificing the migration paths? Is this a simplification that assumes the number of users that will need this has become negligible at this point? (asking out of curiosity.)

@DougGregor DougGregor deleted the finish-se-0028 branch December 11, 2022 16:17
@DougGregor
Copy link
Member Author

@DougGregor Why are we sacrificing the migration paths? Is this a simplification that assumes the number of users that will need this has become negligible at this point? (asking out of curiosity.)

It has been an error in the parser since 2016, so it's not really a feasible migration path anymore, and the number of users who need it should be close to zero.

I'm removing these because the implementation is not correct. For one, __FILE__ et al should not be keywords, they should be normal identifiers. Additionally, we shouldn't produce this kind of error in the parser: if we care about this diagnostic (say, to help folks who come from C and try to use __FILE__), we should implement it in the type checker when the constraint solver fails to find a declaration named __FILE__.

Regardless, this implementation of this special diagnostic had to go. I'm calling it low-value enough that it's better to remove it rather than reimplement it.

@AnthonyLatsis
Copy link
Collaborator

Thank you for clarifying!

I'm removing these because the implementation is not correct. For one, __FILE__ et al should not be keywords, they should be normal identifiers. Additionally, we shouldn't produce this kind of error in the parser: if we care about this diagnostic (say, to help folks who come from C and try to use __FILE__), we should implement it in the type checker when the constraint solver fails to find a declaration named __FILE__.

This makes a lot of sense.

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.

3 participants