@@ -335,6 +335,10 @@ enum class FixKind : uint8_t {
335
335
336
336
// / Allow `weak` declarations to be bound to a non-optional type.
337
337
AllowNonOptionalWeak,
338
+
339
+ // / Fix conversion from non-Sendable to Sendable by adding explicit
340
+ // / @Sendable attribute to the source function.
341
+ AddSendableAttribute,
338
342
};
339
343
340
344
class ConstraintFix {
@@ -735,8 +739,9 @@ class ForceOptional final : public ContextualMismatch {
735
739
// / function types, repair it by adding @Sendable attribute.
736
740
class AddSendableAttribute final : public ContextualMismatch {
737
741
AddSendableAttribute (ConstraintSystem &cs, FunctionType *fromType,
738
- FunctionType *toType, ConstraintLocator *locator)
739
- : ContextualMismatch(cs, fromType, toType, locator) {
742
+ FunctionType *toType, ConstraintLocator *locator)
743
+ : ContextualMismatch(cs, FixKind::AddSendableAttribute, fromType, toType,
744
+ locator) {
740
745
assert (fromType->isSendable () != toType->isSendable ());
741
746
}
742
747
@@ -746,9 +751,13 @@ class AddSendableAttribute final : public ContextualMismatch {
746
751
bool diagnose (const Solution &solution, bool asNote = false ) const override ;
747
752
748
753
static AddSendableAttribute *create (ConstraintSystem &cs,
749
- FunctionType *fromType,
750
- FunctionType *toType,
751
- ConstraintLocator *locator);
754
+ FunctionType *fromType,
755
+ FunctionType *toType,
756
+ ConstraintLocator *locator);
757
+
758
+ static bool classof (ConstraintFix *fix) {
759
+ return fix->getKind () == FixKind::AddSendableAttribute;
760
+ }
752
761
};
753
762
754
763
// / This is a contextual mismatch between throwing and non-throwing
0 commit comments