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 1, 2023
1 parent a5607cc commit 3ad2fc6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/Sema/CSSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6453,6 +6453,13 @@ bool ConstraintSystem::repairFailures(
getConstraintLocator(anchor, path));
}

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

// When the solver sets `TMF_MatchingGenericArguments` it means
// that it's matching generic argument pairs to identify any mismatches
// as part of larger matching of two generic types. Letting this
Expand Down

0 comments on commit 3ad2fc6

Please sign in to comment.