Sema: Fix for accidental desugaring in simplifyType()

When called with a ParenType wrapping a DependentMemberType,
we would drop the ParenType because we used type->getAs<ParenType>()
rather than dyn_cast<ParenType>(type.getPointer()).

This fixes an existing QoI issue with closure argument tuples,
and prevents another regression once SubstitutedType is removed.
This commit is contained in:
Slava Pestov
2016-12-07 02:46:20 -08:00
parent cc23f04140
commit ed75fdacab
2 changed files with 3 additions and 3 deletions

View File

@@ -1513,7 +1513,7 @@ Type ConstraintSystem::simplifyType(Type type) {
// If this is a dependent member type for which we end up simplifying
// the base to a non-type-variable, perform lookup.
if (auto depMemTy = type->getAs<DependentMemberType>()) {
if (auto depMemTy = dyn_cast<DependentMemberType>(type.getPointer())) {
// Simplify the base.
Type newBase = simplifyType(depMemTy->getBase());
if (!newBase) return type;
@@ -1586,7 +1586,7 @@ Type Solution::simplifyType(TypeChecker &tc, Type type) const {
// If this is a dependent member type for which we end up simplifying
// the base to a non-type-variable, perform lookup.
if (auto depMemTy = type->getAs<DependentMemberType>()) {
if (auto depMemTy = dyn_cast<DependentMemberType>(type.getPointer())) {
// Simplify the base.
Type newBase = simplifyType(tc, depMemTy->getBase());
if (!newBase) return type;