@@ -402,7 +402,8 @@ ASTContext::ASTContext(LangOptions &langOpts, SearchPathOptions &SearchPathOpts,
402
402
SwiftShimsModuleName(getIdentifier(SWIFT_SHIMS_NAME)),
403
403
TypeCheckerDebug(new StderrTypeCheckerDebugConsumer()),
404
404
TheErrorType(
405
- new (*this , AllocationArena::Permanent) ErrorType(*this , Type())),
405
+ new (*this , AllocationArena::Permanent)
406
+ ErrorType(*this , Type(), RecursiveTypeProperties::HasError)),
406
407
TheUnresolvedType(new (*this , AllocationArena::Permanent)
407
408
UnresolvedType(*this )),
408
409
TheEmptyTupleType(TupleType::get(ArrayRef<TupleTypeElt>(), *this)),
@@ -2435,16 +2436,19 @@ Type ErrorType::get(const ASTContext &C) { return C.TheErrorType; }
2435
2436
Type ErrorType::get (Type originalType) {
2436
2437
assert (originalType);
2437
2438
2438
- auto properties = originalType->getRecursiveProperties ();
2439
- auto arena = getArena (properties );
2439
+ auto originalProperties = originalType->getRecursiveProperties ();
2440
+ auto arena = getArena (originalProperties );
2440
2441
2441
2442
auto &ctx = originalType->getASTContext ();
2442
2443
auto &entry = ctx.Impl .getArena (arena).ErrorTypesWithOriginal [originalType];
2443
2444
if (entry) return entry;
2444
2445
2445
2446
void *mem = ctx.Allocate (sizeof (ErrorType) + sizeof (Type),
2446
2447
alignof (ErrorType), arena);
2447
- return entry = new (mem) ErrorType (ctx, originalType);
2448
+ RecursiveTypeProperties properties = RecursiveTypeProperties::HasError;
2449
+ if (originalProperties.hasTypeVariable ())
2450
+ properties |= RecursiveTypeProperties::HasTypeVariable;
2451
+ return entry = new (mem) ErrorType (ctx, originalType, properties);
2448
2452
}
2449
2453
2450
2454
BuiltinIntegerType *BuiltinIntegerType::get (BuiltinIntegerWidth BitWidth,
0 commit comments