mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[CS] Better diagnose inout argument in tuple construction
Previously we relied on `TupleTypeElt::getType` returning an `InOutType` to fail the tuple type matching logic. Instead, add logic to reject any inout arguments up-front with a more specific diagnostic. Also, while we're here, strip the `_const` parameter flag, as it's not something that needs to be considered for tuple construction.
This commit is contained in:
@@ -5608,6 +5608,13 @@ Solution::getFunctionArgApplyInfo(ConstraintLocator *locator) const {
|
||||
if (simplifyType(rawFnType)->is<UnresolvedType>())
|
||||
return None;
|
||||
|
||||
// A tuple construction is spelled in the AST as a function call, but
|
||||
// is really more like a tuple conversion.
|
||||
if (auto metaTy = simplifyType(rawFnType)->getAs<MetatypeType>()) {
|
||||
if (metaTy->getInstanceType()->is<TupleType>())
|
||||
return None;
|
||||
}
|
||||
|
||||
assert(!shouldHaveDirectCalleeOverload(call) &&
|
||||
"Should we have resolved a callee for this?");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user