-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Macros] Expression macro as caller-side default argument #70602
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
[Macros] Expression macro as caller-side default argument #70602
Conversation
21938c9
to
b2baf7c
Compare
@swift-ci please smoke test |
@swift-ci please smoke test |
248e821
to
594d56b
Compare
@swift-ci please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking very good. There are a few tests we still need:
- One that serializes a public function using a default argument that's a macro expansion, then calls it from another module
- One that prints an API with a public function containing such a default argument into a .swiftinterface fiel
- One that checks the access control restrictions on the macros that can be used from a default argument
swiftlang/swift-syntax#2447 |
This will also make |
@swift-ci please build toolchain |
swiftlang/swift-syntax#2447 |
Test shadowed variable of same type Fully type check caller side macro expansion Skip macro default arg caller side expr at decl primary Test macro expand more complex expressions Set synthesized expression as implicit Add test case for with argument, not compiling currently Test with swiftinterface Always use the string representation of the default argument Now works across module boundary Check works for multiple files Make default argument expression work in single file Use expected-error Disallow expression macro as default argument Using as a sub expression in default argument still allowed as expression macros behave the same as built-in magic literals
Need to use variable from caller side context
44aed25
to
8da4b1e
Compare
swiftlang/swift-syntax#2447 |
swiftlang/swift-syntax#2447 |
Implementation for [Pitch] Expression macro as caller-side default argument
Corresponding Swift Syntax PR: swiftlang/swift-syntax#2447
Resolves rdar://112031348