-
Notifications
You must be signed in to change notification settings - Fork 439
Fold operators using the standard operator table in MacroSystem
#2132
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
Conversation
6f7ffe4
to
565b396
Compare
@swift-ci Please test |
@swift-ci Please test Windows |
in context: MacroExpansionContext, | ||
foldingWith operatorTable: OperatorTable? | ||
) -> Self { | ||
return (detach(in: context, foldingWith: operatorTable) as Syntax).cast(Self.self) |
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.
return (detach(in: context, foldingWith: operatorTable) as Syntax).cast(Self.self) | |
return (detach(in: context, foldingWith: operatorTable) as Syntax).cast(Self.self) |
What's the as
needed for here? Doesn't this already return a Syntax
?
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.
It’s to disambiguate the version of detach
that is being called. Without as Syntax
we would have an infinite recursion here.
565b396
to
0af1cb8
Compare
@swift-ci Please test |
@swift-ci Please test Windows |
The compiler folds operators in attributes and freestanding macro nodes but `MacroSystem` wasn’t doing that. But it should to match the compiler behavior. rdar://114786803 Fixes swiftlang#2128
0af1cb8
to
12c0887
Compare
@swift-ci Please test |
@swift-ci Please test Windows |
The compiler folds operators in attributes and freestanding macro nodes but
MacroSystem
wasn’t doing that. But it should to match the compiler behavior.rdar://114786803
Fixes #2128