2424#include " swift/AST/Type.h"
2525#include " swift/AST/Types.h"
2626#include " swift/Basic/Debug.h"
27+ #include " swift/Sema/Constraint.h"
2728#include " swift/Sema/ConstraintLocator.h"
2829#include " swift/Sema/FixBehavior.h"
2930#include " llvm/ADT/ArrayRef.h"
@@ -479,8 +480,8 @@ enum class FixKind : uint8_t {
479480 // / parameter.
480481 // /
481482 // / 2. Where we have a function that expects a function typed parameter with a
482- // / sending result, but is passed a function typeed parameter without a
483- // / sending result.
483+ // / sending result, but is passed a function typed parameter without a sending
484+ // / result.
484485 AllowSendingMismatch,
485486};
486487
@@ -2636,26 +2637,16 @@ class TreatEphemeralAsNonEphemeral final : public AllowArgumentMismatch {
26362637// / non-Sendable is safe to transfer onto other situations. The caller though
26372638// / that this is being sent to does not enforce that invariants within its body.
26382639class AllowSendingMismatch final : public ContextualMismatch {
2639- public:
2640- enum class Kind {
2641- Parameter,
2642- Result,
2643- };
2644-
2645- private:
2646- Kind kind;
2647-
26482640 AllowSendingMismatch (ConstraintSystem &cs, Type argType, Type paramType,
2649- ConstraintLocator *locator, Kind kind,
2650- FixBehavior fixBehavior)
2641+ ConstraintLocator *locator, FixBehavior fixBehavior)
26512642 : ContextualMismatch(cs, FixKind::AllowSendingMismatch, argType,
2652- paramType, locator, fixBehavior),
2653- kind (kind) {}
2643+ paramType, locator, fixBehavior) {}
26542644
26552645public:
26562646 std::string getName () const override {
2657- return " treat a function argument with sending parameter as a function "
2658- " argument without sending parameters" ;
2647+ return " treat a function argument with sending parameters and results as a "
2648+ " function "
2649+ " argument without sending parameters and results" ;
26592650 }
26602651
26612652 bool diagnose (const Solution &solution, bool asNote = false ) const override ;
@@ -2664,9 +2655,8 @@ class AllowSendingMismatch final : public ContextualMismatch {
26642655 return diagnose (*commonFixes.front ().first );
26652656 }
26662657
2667- static AllowSendingMismatch *create (ConstraintSystem &cs,
2668- ConstraintLocator *locator, Type srcType,
2669- Type dstType, Kind kind);
2658+ static AllowSendingMismatch *create (ConstraintSystem &cs, Type srcType,
2659+ Type dstType, ConstraintLocator *locator);
26702660
26712661 static bool classof (const ConstraintFix *fix) {
26722662 return fix->getKind () == FixKind::AllowSendingMismatch;
0 commit comments