File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -4092,11 +4092,23 @@ bool ConstraintSystem::repairFailures(
4092
4092
path.pop_back ();
4093
4093
// If this is a contextual mismatch between l-value types e.g.
4094
4094
// `@lvalue String vs. @lvalue Int`, let's pretend that it's okay.
4095
- if (!path.empty () && path.back ().is <LocatorPathElt::ContextualType>()) {
4096
- auto *locator = getConstraintLocator (anchor, path.back ());
4097
- conversionsOrFixes.push_back (
4098
- IgnoreContextualType::create (*this , lhs, rhs, locator));
4099
- break ;
4095
+ if (!path.empty ()) {
4096
+ if (path.back ().is <LocatorPathElt::ContextualType>()) {
4097
+ auto *locator = getConstraintLocator (anchor, path.back ());
4098
+ conversionsOrFixes.push_back (
4099
+ IgnoreContextualType::create (*this , lhs, rhs, locator));
4100
+ break ;
4101
+ }
4102
+
4103
+ // If this is a function type param type mismatch in any position,
4104
+ // the mismatch we want to report is for the whole structural type.
4105
+ auto last = std::find_if (
4106
+ path.rbegin (), path.rend (), [](LocatorPathElt &elt) -> bool {
4107
+ return elt.is <LocatorPathElt::FunctionArgument>();
4108
+ });
4109
+
4110
+ if (last != path.rend ())
4111
+ break ;
4100
4112
}
4101
4113
4102
4114
LLVM_FALLTHROUGH;
You can’t perform that action at this time.
0 commit comments