[CS] Be more defensive in isIUOWrappedInParens() check

This commit is contained in:
Suyash Srijan
2019-08-29 20:38:57 +01:00
parent b32386bcac
commit fc9fef2cf3

View File

@@ -2199,13 +2199,18 @@ void ConstraintSystem::resolveOverload(ConstraintLocator *locator,
if (!type || !type->is<AnyFunctionType>())
return false;
if (auto call = dyn_cast<CallExpr>(locator->getAnchor()))
return call->getSemanticFn() != call->getFn();
auto expr = locator->getAnchor();
if (!expr)
return false;
if (auto paren = getParentExpr(locator->getAnchor())) {
return isa<ParenExpr>(paren);
if (isa<CallExpr>(expr)) {
return false;
}
auto parentExpr = getParentExpr(expr);
if (parentExpr && isa<ParenExpr>(parentExpr))
return true;
return false;
};