mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Diagnostics] Add CSFix::diagnoseForAmbiguity for diagnosing common
fixes that appear in all solutions.
This commit is contained in:
committed by
Pavel Yaskevich
parent
54706ba79b
commit
651c27b50b
@@ -479,6 +479,24 @@ bool DefineMemberBasedOnUse::diagnose(bool asNote) const {
|
||||
return AlreadyDiagnosed || failure.diagnose(asNote);
|
||||
}
|
||||
|
||||
bool
|
||||
DefineMemberBasedOnUse::diagnoseForAmbiguity(ArrayRef<Solution> solutions) const {
|
||||
Type concreteBaseType;
|
||||
for (const auto &solution: solutions) {
|
||||
auto baseType = solution.simplifyType(BaseType);
|
||||
if (!concreteBaseType)
|
||||
concreteBaseType = baseType;
|
||||
|
||||
if (concreteBaseType->getCanonicalType() != baseType->getCanonicalType()) {
|
||||
getConstraintSystem().getASTContext().Diags.diagnose(getAnchor()->getLoc(),
|
||||
diag::unresolved_member_no_inference, Name);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return diagnose();
|
||||
}
|
||||
|
||||
DefineMemberBasedOnUse *
|
||||
DefineMemberBasedOnUse::create(ConstraintSystem &cs, Type baseType,
|
||||
DeclNameRef member, bool alreadyDiagnosed,
|
||||
|
||||
Reference in New Issue
Block a user