@@ -290,6 +290,9 @@ enum class FixKind : uint8_t {
290
290
// / Ignore result builder body which fails `pre-check` call.
291
291
IgnoreInvalidResultBuilderBody,
292
292
293
+ // / Ignore result builder body if it has `return` statements.
294
+ IgnoreResultBuilderWithReturnStmts,
295
+
293
296
// / Resolve type of `nil` by providing a contextual type.
294
297
SpecifyContextualTypeForNil,
295
298
@@ -2503,10 +2506,15 @@ class AllowKeyPathWithoutComponents final : public ConstraintFix {
2503
2506
};
2504
2507
2505
2508
class IgnoreInvalidResultBuilderBody : public ConstraintFix {
2506
- protected:
2507
2509
IgnoreInvalidResultBuilderBody (ConstraintSystem &cs,
2508
2510
ConstraintLocator *locator)
2509
- : ConstraintFix(cs, FixKind::IgnoreInvalidResultBuilderBody, locator) {}
2511
+ : IgnoreInvalidResultBuilderBody(
2512
+ cs, FixKind::IgnoreInvalidResultBuilderBody, locator) {}
2513
+
2514
+ protected:
2515
+ IgnoreInvalidResultBuilderBody (ConstraintSystem &cs, FixKind kind,
2516
+ ConstraintLocator *locator)
2517
+ : ConstraintFix(cs, kind, locator) {}
2510
2518
2511
2519
public:
2512
2520
std::string getName () const override {
@@ -2533,13 +2541,19 @@ class IgnoreResultBuilderWithReturnStmts final
2533
2541
2534
2542
IgnoreResultBuilderWithReturnStmts (ConstraintSystem &cs, Type builderTy,
2535
2543
ConstraintLocator *locator)
2536
- : IgnoreInvalidResultBuilderBody(cs, locator), BuilderType(builderTy) {}
2544
+ : IgnoreInvalidResultBuilderBody(
2545
+ cs, FixKind::IgnoreResultBuilderWithReturnStmts, locator),
2546
+ BuilderType (builderTy) {}
2537
2547
2538
2548
public:
2539
2549
bool diagnose (const Solution &solution, bool asNote = false ) const override ;
2540
2550
2541
2551
static IgnoreResultBuilderWithReturnStmts *
2542
2552
create (ConstraintSystem &cs, Type builderTy, ConstraintLocator *locator);
2553
+
2554
+ static bool classof (ConstraintFix *fix) {
2555
+ return fix->getKind () == FixKind::IgnoreResultBuilderWithReturnStmts;
2556
+ }
2543
2557
};
2544
2558
2545
2559
class SpecifyContextualTypeForNil final : public ConstraintFix {
0 commit comments