@@ -710,54 +710,39 @@ Type ConstraintSystem::getFixedTypeRecursive(Type type,
710
710
bool wantRValue,
711
711
bool retainParens) {
712
712
713
- // FIXME: This function doesn't strictly honor retainParens
714
- // everywhere.
713
+ if (wantRValue)
714
+ type = type-> getRValueType ();
715
715
716
- if (retainParens) {
717
- if (wantRValue)
718
- type = type->getRValueType ();
719
-
720
- if (auto *parenTy = dyn_cast<ParenType>(type.getPointer ())) {
716
+ if (auto *parenTy = dyn_cast<ParenType>(type.getPointer ())) {
717
+ if (retainParens) {
721
718
auto fixed = getFixedTypeRecursive (parenTy->getUnderlyingType (), flags,
722
719
wantRValue, retainParens);
723
720
return withParens (*this , fixed, parenTy);
724
721
}
725
722
}
726
723
727
- while (true ) {
728
- if (wantRValue)
729
- type = type->getRValueType ();
730
-
731
- if (auto depMemType = type->getAs <DependentMemberType>()) {
732
- if (!depMemType->getBase ()->isTypeVariableOrMember ()) return type;
724
+ if (auto depMemType = type->getAs <DependentMemberType>()) {
725
+ if (!depMemType->getBase ()->isTypeVariableOrMember ()) return type;
733
726
734
- // FIXME: Perform a more limited simplification?
735
- Type newType = simplifyType (type);
736
- if (newType.getPointer () == type.getPointer ()) return type;
727
+ // FIXME: Perform a more limited simplification?
728
+ Type newType = simplifyType (type);
729
+ if (newType.getPointer () == type.getPointer ()) return type;
737
730
738
- type = newType;
739
-
740
- // Once we've simplified a dependent member type, we need to generate a
741
- // new constraint.
742
- flags |= TMF_GenerateConstraints;
743
- continue ;
744
- }
745
-
746
- auto typeVar = type->getAs <TypeVariableType>();
747
- if (!typeVar)
748
- return type;
731
+ // Once we've simplified a dependent member type, we need to generate a
732
+ // new constraint.
733
+ flags |= TMF_GenerateConstraints;
749
734
750
- if (auto fixed = getFixedType (typeVar)) {
751
- type = fixed;
752
- continue ;
753
- }
735
+ return getFixedTypeRecursive (newType, flags, wantRValue, retainParens);
736
+ }
754
737
755
- if (retainParens)
756
- if (auto *parenType = dyn_cast<ParenType>(type. getPointer () ))
757
- return withParens (* this , getRepresentative (typeVar), parenType );
738
+ if ( auto typeVar = type-> getAs <TypeVariableType>()) {
739
+ if (auto fixed = getFixedType (typeVar ))
740
+ return getFixedTypeRecursive (fixed, flags, wantRValue, retainParens );
758
741
759
742
return getRepresentative (typeVar);
760
743
}
744
+
745
+ return type;
761
746
}
762
747
763
748
// / Does a var or subscript produce an l-value?
0 commit comments