[AST] NFC: De-boilerplate "has ParenType sugar"

This commit is contained in:
David Zarzycki
2017-12-29 11:37:20 -05:00
parent 41a0553228
commit 62795501d9
10 changed files with 19 additions and 18 deletions

View File

@@ -1171,7 +1171,7 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
if (last != path.rend()) {
if (last->getKind() == ConstraintLocator::ApplyArgToParam) {
if (auto *paren2 = dyn_cast<ParenType>(func2Input.getPointer())) {
if (!isa<ParenType>(func1Input.getPointer()))
if (!func1Input->hasParenSugar())
func2Input = paren2->getUnderlyingType();
}
}
@@ -1562,8 +1562,7 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
typeVar2 = dyn_cast<TypeVariableType>(type2.getPointer());
// If the types are obviously equivalent, we're done.
if (isa<ParenType>(type1.getPointer()) ==
isa<ParenType>(type2.getPointer()) &&
if (type1->hasParenSugar() == type2->hasParenSugar() &&
type1->isEqual(type2))
return SolutionKind::Solved;
} else {
@@ -1747,8 +1746,7 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
if (isArgumentTupleMatch &&
!isSwiftVersion3) {
if (!typeVar1 && !typeVar2) {
if (isa<ParenType>(type1.getPointer()) !=
isa<ParenType>(type2.getPointer())) {
if (type1->hasParenSugar() != type2->hasParenSugar()) {
return SolutionKind::Error;
}
}