-
Notifications
You must be signed in to change notification settings - Fork 440
Replace most generated code in SyntaxCollections.swift by default protocol implementations #1787
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
Replace most generated code in SyntaxCollections.swift by default protocol implementations #1787
Conversation
@@ -173,7 +173,7 @@ extension ExprListSyntax: ExpressibleByArrayLiteral { | |||
public init(_ elements: [ExprSyntaxProtocol]) { | |||
self = ExprListSyntax(elements.map { | |||
ExprSyntax(fromProtocol: $0) | |||
}) | |||
} as [ExprSyntax]) |
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.
Why is this needed now?
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.
I think it’s something to do with the initializer being moved to an extension and thus it doesn’t have higher precedence than this initializer that that takes [ExprSyntaxProtocol]
anymore. But I haven’t reduced it to a minimal reproducer.
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 much code deletion brings happy tears
@swift-ci Please test |
5d10772
to
3276f80
Compare
@swift-ci Please test |
@swift-ci Please test Windows |
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.
😍
…tocol implementations This has two advantages. 1. It reduces the amout of code in swift-syntax 2. It actually makes all the functions defined in every `SyntaxCollection` accessible for existentials or generics over `SyntaxCollection`.
3276f80
to
f8d304c
Compare
@swift-ci Please test |
@swift-ci Please test Windows |
This has two advantages.
SyntaxCollection
accessible for existentials or generics overSyntaxCollection
.