mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Model Pack Types
A pack type looks a lot like a tuple in the surface language, except there
is no way for the user to spell a pack. Pack types are created by the solver
when it encounters an apply of a variadic generic function, as in
```
func print<T...>(_ xs: T...) {}
// Creates a pack type <String, Int, String>
print("Macs say Hello in", 42, " different languages")
```
Pack types substituted into the variadic generic arguments of a
PackExpansionType "trip" the pack expansion and cause it to produce a
new pack type with the pack expansion pattern applied.
```
typealias Foo<T...> = (T?...)
Foo<Int, String, Int> // Forces expansion to (Int?, String?, Int?)
```
This commit is contained in:
@@ -1695,7 +1695,11 @@ public:
|
||||
return handleGenericNominalType(pattern.getType(), bgt,
|
||||
pattern.getGenericSignatureOrNull());
|
||||
}
|
||||
|
||||
|
||||
CanType visitPackType(PackType *pack, AbstractionPattern pattern) {
|
||||
llvm_unreachable("Unimplemented!");
|
||||
}
|
||||
|
||||
CanType visitTupleType(TupleType *tuple, AbstractionPattern pattern) {
|
||||
if (auto gp = handleTypeParameterInAbstractionPattern(pattern, tuple))
|
||||
return gp;
|
||||
|
||||
Reference in New Issue
Block a user