mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CSDiagnostics] Adjust generic requirement diagnostics for inference from defaults
Contextual type could be a type variable or a type with type variables that have a set of generic requirements, so affected declaration is the owner of the generic parameter.
This commit is contained in:
@@ -257,6 +257,11 @@ ValueDecl *RequirementFailure::getDeclRef() const {
|
||||
return cast<ValueDecl>(getDC()->getAsDecl());
|
||||
}
|
||||
|
||||
if (contextualPurpose == CTP_DefaultParameter ||
|
||||
contextualPurpose == CTP_AutoclosureDefaultParameter) {
|
||||
return cast<ValueDecl>(getDC()->getParent()->getAsDecl());
|
||||
}
|
||||
|
||||
return getAffectedDeclFromType(contextualTy);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user