mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[CSBindings] Diagnose leading-dot inference failure when base type is attempted as placeholder
Diagnose base inference failure only if base gets inferred to be a placeholder, any transitive placeholder inference points to the problem being elsewhere.
This commit is contained in:
committed by
Pavel Yaskevich
parent
d445a18a32
commit
dba1b3436a
@@ -6185,21 +6185,10 @@ bool ConstraintSystem::repairFailures(
|
||||
}
|
||||
|
||||
case ConstraintLocator::UnresolvedMemberChainResult: {
|
||||
// Ignore this mismatch if result is already a hole.
|
||||
if (rhs->isPlaceholder())
|
||||
// Ignore this mismatch if base or result is already a hole.
|
||||
if (lhs->isPlaceholder() || rhs->isPlaceholder())
|
||||
return true;
|
||||
|
||||
// The base is a placeholder, let's report an unknown base issue.
|
||||
if (lhs->isPlaceholder()) {
|
||||
auto *baseExpr =
|
||||
castToExpr<UnresolvedMemberChainResultExpr>(anchor)->getChainBase();
|
||||
|
||||
auto *fix = SpecifyBaseTypeForContextualMember::create(
|
||||
*this, baseExpr->getName(), getConstraintLocator(locator));
|
||||
conversionsOrFixes.push_back(fix);
|
||||
break;
|
||||
}
|
||||
|
||||
if (repairViaOptionalUnwrap(*this, lhs, rhs, matchKind, conversionsOrFixes,
|
||||
locator))
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user