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
Swift: extract parameter packs #14734
base: main
Are you sure you want to change the base?
Conversation
75a688c
to
360cc2f
Compare
| @@ -1426,6 +1426,23 @@ module Exprs { | |||
| } | |||
| } | |||
|
|
|||
| /** Control-flow for a Pack Expansion. See the QLDocs for `PackExpansionExpr` and `PackElementExpr` for the semantics. */ | |||
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.
There is no QLDoc on PackExpansionExpr nor PackElementExpr that explains the semantics of them. Is that a copy/pasting gone wrong? Or did you intend to write down what these actually mean? 😄
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.
Yeah, I think it's just a bad copy-paste. There are some docs, but I guess those do not explain semantics. I'll update the docs and add some links to the official docs.
| func makeTuple<each T>(_ t: repeat each T) -> (repeat each T) { | ||
| return (repeat each t) | ||
| } |
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.
They really didn't want the C++ ... syntax, so they just relabeled it, eh? 😆
swift/schema.py
Outdated
|
|
||
| class PackExpansionExpr(Expr): | ||
| """ | ||
| A pattern expression followed by the expansion operator '...'. |
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.
only that it's not ... any more, isn't it?
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.
Good catch, the sources refer to these as ... though, I'll update the docs in the other round when I'm done with the rest.
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.
yeah, I think their temporary syntax while they were implementing this in the background throughout 5.8 was that, but then they bikeshedded the sh*t out of it but did not update the naming everywhere 😆
| """ | ||
| pattern_expr: Expr | child | ||
|
|
||
| class PackElementExpr(Expr): |
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.
you can now use @qltest.test_with(PackExpansionExpr) to avoid having a separate generated test directory for this, repeating the same sources. You also save on extraction time like this.
swift/schema.py
Outdated
| class ElementArchetypeType(LocalArchetypeType): | ||
| pass | ||
|
|
||
| class PackArchetypeType(ArchetypeType): | ||
| pass | ||
|
|
||
| class PackType(Type): | ||
| elements: list[Type] | ||
|
|
||
| class PackExpansionType(Type): | ||
| pattern_type: Type | ||
| count_type: Type | ||
|
|
||
| class PackElementType(Type): | ||
| pack_type: Type | ||
|
|
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.
these can also have their tests grouped, right? They probably can go all under @qltest.test_with("PackType") (use PackType if the definition is there, and "PackType" if it is a kind of "forward" definition).
360cc2f
to
e865c3c
Compare
|
Database upgrade is coming as a separate PR on top of this one. |
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.
Thanks for this!
…upgrade Swift: parameter packs migration scripts
No description provided.