-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Preliminary constraint solver support for variadic generics #61465
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
Preliminary constraint solver support for variadic generics #61465
Conversation
4d747da
to
bdc8169
Compare
5d8f3a2
to
4476813
Compare
@swift-ci Please smoke test |
The expression type checker replaces type variables with UnresolvedType and PlaceholderType sometimes, so allow them to appear here.
…n unlabeled element
I'm also going to use it in TypeMatcher, for the Requirement Machine's same-type requirement desugaring.
…ns with new utilities
…nsions into account
4476813
to
b9d7201
Compare
@swift-ci Please smoke test |
auto *packType = cast<PackType>(desugar2); | ||
|
||
if (packExpansionType->getPatternType()->is<TypeVariableType>()) | ||
return matchTypes(packExpansionType->getPatternType(), packType, kind, subflags, locator); |
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.
Is the idea here is that we'd like to resolve a pattern type of expansion using a pack type (type2) but at the same we don't want to double-check the matching if the pattern is already resolved? Could there be a situation when either pattern or pack type are only partially resolved and need matching to facilitate further inference?
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 was a hack to work around other problems in PackExpansionMatcher.cpp. This chunk of code was removed in subsequent PRs.
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.
Sounds good! I'll working through the list :)
|
||
bool TupleType::containsPackExpansionType() const { | ||
for (auto elt : getElements()) { | ||
if (elt.getType()->is<PackExpansionType>()) |
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 not make this a property of a tuple 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.
That's a good idea. I wanted to wait to micro-optimize until more code is fleshed out though.
No description provided.