[Diagnostics] Diagnose that we cannot infer the key path type when binding to a hole

This commit is contained in:
Luciano Almeida
2020-05-11 18:08:40 -03:00
parent 98d3a81ede
commit 02c454c976
8 changed files with 98 additions and 4 deletions

View File

@@ -1323,3 +1323,17 @@ AllowKeyPathRootTypeMismatch::create(ConstraintSystem &cs, Type lhs, Type rhs,
return new (cs.getAllocator())
AllowKeyPathRootTypeMismatch(cs, lhs, rhs, locator);
}
SpecifyKeyPathRootType *
SpecifyKeyPathRootType::create(ConstraintSystem &cs,
ConstraintLocator *locator) {
return new (cs.getAllocator())
SpecifyKeyPathRootType(cs, locator);
}
bool SpecifyKeyPathRootType::diagnose(const Solution &solution,
bool asNote) const {
UnableToInferKeyPathRootFailure failure(solution, getLocator());
return failure.diagnose(asNote);
}