Merge pull request #27995 from theblixguy/fix/SR-11684

[PropertyWrappers] Mark the property as invalid when there is a mismatch with wrappedValue type
This commit is contained in:
Suyash Srijan
2019-11-05 01:25:51 +00:00
committed by GitHub
6 changed files with 47 additions and 5 deletions

View File

@@ -2980,6 +2980,16 @@ bool ConstraintSystem::repairFailures(
locator);
}
// Let's not complain about argument type mismatch if we have a synthesized
// wrappedValue initializer, because we already emit a diagnostic for a
// type mismatch between the property's type and the wrappedValue type.
if (auto CE = dyn_cast<CallExpr>(loc->getAnchor())) {
if (CE->isImplicit() && !CE->getArgumentLabels().empty() &&
CE->getArgumentLabels().front() == getASTContext().Id_wrappedValue) {
break;
}
}
conversionsOrFixes.push_back(
AllowArgumentMismatch::create(*this, lhs, rhs, loc));
break;