mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Add Sugar for Variadics
We used to represent the interface type of variadic parameters directly with ArraySliceType. This was awfully convenient for the constraint solver since it could just canonicalize and open [T] to Array<$T> wherever it saw a variadic parameter. However, this both destroys the sugaring of T... and locks the representation to Array<T>. In the interest of generalizing this in the future, introduce VariadicSequenceType. For now, it canonicalizes to Array<T> just like the old representation. But, as you can guess, this is a new staging point for teaching the solver how to munge variadic generic type bindings. rdar://81628287
This commit is contained in:
@@ -4544,6 +4544,11 @@ public:
|
||||
S.addTypeRef(dictTy->getValueType()));
|
||||
}
|
||||
|
||||
void visitVariadicSequenceType(const VariadicSequenceType *seqTy) {
|
||||
using namespace decls_block;
|
||||
serializeSimpleWrapper<VariadicSequenceTypeLayout>(seqTy->getBaseType());
|
||||
}
|
||||
|
||||
void visitOptionalType(const OptionalType *optionalTy) {
|
||||
using namespace decls_block;
|
||||
serializeSimpleWrapper<OptionalTypeLayout>(optionalTy->getBaseType());
|
||||
@@ -4747,6 +4752,7 @@ void Serializer::writeAllDeclsAndTypes() {
|
||||
registerDeclTypeAbbr<SILFunctionTypeLayout>();
|
||||
registerDeclTypeAbbr<ArraySliceTypeLayout>();
|
||||
registerDeclTypeAbbr<DictionaryTypeLayout>();
|
||||
registerDeclTypeAbbr<VariadicSequenceTypeLayout>();
|
||||
registerDeclTypeAbbr<ReferenceStorageTypeLayout>();
|
||||
registerDeclTypeAbbr<UnboundGenericTypeLayout>();
|
||||
registerDeclTypeAbbr<OptionalTypeLayout>();
|
||||
|
||||
Reference in New Issue
Block a user