Merge pull request #38111 from xedin/rdar-79672230

[Diagnostics] Fix requirement note to properly handle layout requirements
This commit is contained in:
Pavel Yaskevich
2021-06-28 10:03:08 -07:00
committed by GitHub
6 changed files with 28 additions and 11 deletions

View File

@@ -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;
}