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

[AccessorMacro] disallow accessor macro apply to variable declaration #2630

Closed

Conversation

RayZhao1998
Copy link

Resolve #2491

@ahoppen
Copy link
Collaborator

ahoppen commented Apr 29, 2024

This change will only disallow accessor macros on let variables in assertMacroExpansion, not during compilation. Disallowing it during compilation needs to be done in the compiler repository. I would prefer not to have a difference in behavior, so those changes would need to be done in sync.

@RayZhao1998
Copy link
Author

All right. Going to close this PR for now. Maybe I can try to make it done in the compiler repository 😀.

@ahoppen
Copy link
Collaborator

ahoppen commented Apr 29, 2024

If you are interested in making the change in the compile repo, it’s probably a var->isLet check that needs to be added for accessors that aren’t valid for let declarations somewhere around here

https://github.com/apple/swift/blob/f7c9966420051fb09926704c2f6d9001242c7e64/lib/Sema/TypeCheckMacros.cpp#L1625

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.

[AccessorMacro] 'let' declarations cannot be computed properties
2 participants