File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -1655,6 +1655,13 @@ ConstraintSystem::matchFunctionBuilder(
1655
1655
assert (builder && " Bad function builder type" );
1656
1656
assert (builder->getAttrs ().hasAttribute <FunctionBuilderAttr>());
1657
1657
1658
+ if (InvalidFunctionBuilderBodies.count (fn)) {
1659
+ (void )recordFix (
1660
+ IgnoreInvalidFunctionBuilderBody::duringConstraintGeneration (
1661
+ *this , getConstraintLocator (fn.getBody ())));
1662
+ return getTypeMatchSuccess ();
1663
+ }
1664
+
1658
1665
// Pre-check the body: pre-check any expressions in it and look
1659
1666
// for return statements.
1660
1667
auto request =
@@ -1720,6 +1727,8 @@ ConstraintSystem::matchFunctionBuilder(
1720
1727
return getTypeMatchFailure (locator);
1721
1728
1722
1729
if (transaction.hasErrors ()) {
1730
+ InvalidFunctionBuilderBodies.insert (fn);
1731
+
1723
1732
if (recordFix (
1724
1733
IgnoreInvalidFunctionBuilderBody::duringConstraintGeneration (
1725
1734
*this , getConstraintLocator (fn.getBody ()))))
Original file line number Diff line number Diff line change @@ -2025,6 +2025,13 @@ class ConstraintSystem {
2025
2025
// / from declared parameters/result and body.
2026
2026
llvm::MapVector<const ClosureExpr *, FunctionType *> ClosureTypes;
2027
2027
2028
+ // / This is a *global* list of all function builder bodies that have
2029
+ // / been determined to be incorrect by failing constraint generation.
2030
+ // /
2031
+ // / Tracking this information is useful to avoid producing duplicate
2032
+ // / diagnostics when function builder has multiple overloads.
2033
+ llvm::SmallDenseSet<AnyFunctionRef> InvalidFunctionBuilderBodies;
2034
+
2028
2035
// / Maps node types used within all portions of the constraint
2029
2036
// / system, instead of directly using the types on the
2030
2037
// / nodes themselves. This allows us to typecheck and
You can’t perform that action at this time.
0 commit comments