File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -367,7 +367,7 @@ class alignas(1 << TypeAlignInBits) TypeBase {
367
367
368
368
// / Reconstitute type sugar, e.g., for array types, dictionary
369
369
// / types, optionals, etc.
370
- TypeBase *reconstituteSugar ();
370
+ TypeBase *reconstituteSugar (bool Recursive );
371
371
372
372
// / getASTContext - Return the ASTContext that this type belongs to.
373
373
ASTContext &getASTContext () {
Original file line number Diff line number Diff line change @@ -1168,8 +1168,8 @@ CanType TypeBase::getCanonicalType() {
1168
1168
return CanType (Result);
1169
1169
}
1170
1170
1171
- TypeBase *TypeBase::reconstituteSugar () {
1172
- return Type ( this ). transform ( [](Type Ty) -> Type {
1171
+ TypeBase *TypeBase::reconstituteSugar (bool Recursive ) {
1172
+ auto Func = [](Type Ty) -> Type {
1173
1173
if (auto boundGeneric = dyn_cast<BoundGenericType>(Ty.getPointer ())) {
1174
1174
auto &ctx = boundGeneric->getASTContext ();
1175
1175
if (boundGeneric->getDecl () == ctx.getArrayDecl ())
@@ -1184,7 +1184,11 @@ TypeBase *TypeBase::reconstituteSugar() {
1184
1184
get (boundGeneric->getGenericArgs ()[0 ]);
1185
1185
}
1186
1186
return Ty;
1187
- }).getPointer ();
1187
+ };
1188
+ if (Recursive)
1189
+ return Type (this ).transform (Func).getPointer ();
1190
+ else
1191
+ return Func (this ).getPointer ();
1188
1192
}
1189
1193
1190
1194
TypeBase *TypeBase::getDesugaredType () {
Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ Solution ConstraintSystem::finalize(
141
141
142
142
// For each of the type variables, get its fixed type.
143
143
for (auto tv : TypeVariables) {
144
- solution.typeBindings [tv] = simplifyType (tv)->reconstituteSugar ();
144
+ solution.typeBindings [tv] = simplifyType (tv)->reconstituteSugar (false );
145
145
}
146
146
147
147
// For each of the overload sets, get its overload choice.
You can’t perform that action at this time.
0 commit comments