From 56b61ba758b5231d057bf2b3401f56c15bf669ec Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 5 Jun 2017 21:43:34 -0700 Subject: [PATCH] Sema: Don't build ErrorTypes in simplifyType() Instead, just build a new dependent member type with the simplified base type. --- lib/Sema/ConstraintSystem.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/Sema/ConstraintSystem.cpp b/lib/Sema/ConstraintSystem.cpp index 17c4ad2bc78..a0c172652ef 100644 --- a/lib/Sema/ConstraintSystem.cpp +++ b/lib/Sema/ConstraintSystem.cpp @@ -1700,17 +1700,17 @@ Type simplifyTypeImpl(ConstraintSystem &cs, Type type, Fn getFixedTypeFn) { lookupBaseType = objectType; } - if (!lookupBaseType->mayHaveMembers()) return type; - - auto subs = lookupBaseType->getContextSubstitutionMap( + if (lookupBaseType->mayHaveMembers()) { + auto subs = lookupBaseType->getContextSubstitutionMap( cs.DC->getParentModule(), - assocType->getDeclContext()); - auto result = assocType->getDeclaredInterfaceType().subst(subs); + assocType->getDeclContext()); + auto result = assocType->getDeclaredInterfaceType().subst(subs); - if (result) - return result; + if (result) + return result; + } - return DependentMemberType::get(ErrorType::get(newBase), assocType); + return DependentMemberType::get(lookupBaseType, assocType); } return type;