mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CSDiagnostics] Tailor diagnostic for Copyable conformance mismatch in key path context
This commit is contained in:
@@ -683,6 +683,15 @@ bool MissingConformanceFailure::diagnoseAsError() {
|
||||
}
|
||||
}
|
||||
|
||||
if (isExpr<KeyPathExpr>(anchor)) {
|
||||
if (auto *P = dyn_cast<ProtocolDecl>(protocolType->getAnyNominal())) {
|
||||
if (P->isSpecificProtocol(KnownProtocolKind::Copyable)) {
|
||||
emitDiagnostic(diag::expr_keypath_noncopyable_type, nonConformingType);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (diagnoseAsAmbiguousOperatorRef())
|
||||
return true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user