Skip to content

Commit

Permalink
[Sema] Improves diagnostic when passing an argument as property of an…
Browse files Browse the repository at this point in the history
… optional class instance (swiftlang#57437)
  • Loading branch information
Rajveer100 committed Sep 2, 2023
1 parent a5607cc commit 89ab678
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/Sema/CSSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6465,6 +6465,15 @@ bool ConstraintSystem::repairFailures(
// diagnostics.
if (flags.contains(TMF_MatchingGenericArguments))
break;

if (!path.empty()) {
if (path.back().is<LocatorPathElt::ApplyArgToParam>())
conversionsOrFixes.push_back(AllowArgumentMismatch::create(
*this, lhs, rhs, getConstraintLocator(anchor, path)));
else if (path.back().is<LocatorPathElt::ContextualType>())
conversionsOrFixes.push_back(IgnoreContextualType::create(
*this, lhs, rhs, getConstraintLocator(anchor, path)));
}

Type fromType;
Type toType;
Expand Down

0 comments on commit 89ab678

Please sign in to comment.