mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #38111 from xedin/rdar-79672230
[Diagnostics] Fix requirement note to properly handle layout requirements
This commit is contained in:
@@ -399,8 +399,14 @@ bool RequirementFailure::diagnoseAsNote() {
|
||||
const auto &req = getRequirement();
|
||||
const auto *reqDC = getRequirementDC();
|
||||
|
||||
// Layout requirement doesn't have a second type, let's always
|
||||
// `AnyObject`.
|
||||
auto requirementTy = req.getKind() == RequirementKind::Layout
|
||||
? getASTContext().getAnyObjectType()
|
||||
: req.getSecondType();
|
||||
|
||||
emitDiagnosticAt(reqDC->getAsDecl(), getDiagnosticAsNote(), getLHS(),
|
||||
getRHS(), req.getFirstType(), req.getSecondType(), "");
|
||||
getRHS(), req.getFirstType(), requirementTy);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user