@@ -462,9 +462,15 @@ enum class FixKind : uint8_t {
462
462
// / because its name doesn't appear in 'initializes' or 'accesses' attributes.
463
463
AllowInvalidMemberReferenceInInitAccessor,
464
464
465
- // / Ignore an attempt to specialize non-generic type.
465
+ // / Ignore an attempt to specialize a non-generic type.
466
466
AllowConcreteTypeSpecialization,
467
467
468
+ // / Ignore an attempt to specialize a generic function.
469
+ AllowGenericFunctionSpecialization,
470
+
471
+ // / Ignore an attempt to specialize a macro.
472
+ AllowMacroSpecialization,
473
+
468
474
// / Ignore an out-of-place \c then statement.
469
475
IgnoreOutOfPlaceThenStmt,
470
476
@@ -3743,6 +3749,58 @@ class AllowConcreteTypeSpecialization final : public ConstraintFix {
3743
3749
}
3744
3750
};
3745
3751
3752
+ class AllowGenericFunctionSpecialization final : public ConstraintFix {
3753
+ ValueDecl *Decl;
3754
+
3755
+ AllowGenericFunctionSpecialization (ConstraintSystem &cs, ValueDecl *decl,
3756
+ ConstraintLocator *locator)
3757
+ : ConstraintFix(cs, FixKind::AllowConcreteTypeSpecialization, locator),
3758
+ Decl (decl) {}
3759
+
3760
+ public:
3761
+ std::string getName () const override {
3762
+ return " allow generic function specialization" ;
3763
+ }
3764
+
3765
+ bool diagnose (const Solution &solution, bool asNote = false ) const override ;
3766
+
3767
+ bool diagnoseForAmbiguity (CommonFixesArray commonFixes) const override {
3768
+ return diagnose (*commonFixes.front ().first );
3769
+ }
3770
+
3771
+ static AllowGenericFunctionSpecialization *
3772
+ create (ConstraintSystem &cs, ValueDecl *decl, ConstraintLocator *locator);
3773
+
3774
+ static bool classof (const ConstraintFix *fix) {
3775
+ return fix->getKind () == FixKind::AllowGenericFunctionSpecialization;
3776
+ }
3777
+ };
3778
+
3779
+ class AllowMacroSpecialization final : public ConstraintFix {
3780
+ ValueDecl *Decl;
3781
+
3782
+ AllowMacroSpecialization (ConstraintSystem &cs, ValueDecl *decl,
3783
+ ConstraintLocator *locator)
3784
+ : ConstraintFix(cs, FixKind::AllowMacroSpecialization, locator),
3785
+ Decl (decl) {}
3786
+
3787
+ public:
3788
+ std::string getName () const override { return " allow macro specialization" ; }
3789
+
3790
+ bool diagnose (const Solution &solution, bool asNote = false ) const override ;
3791
+
3792
+ bool diagnoseForAmbiguity (CommonFixesArray commonFixes) const override {
3793
+ return diagnose (*commonFixes.front ().first );
3794
+ }
3795
+
3796
+ static AllowMacroSpecialization *create (ConstraintSystem &cs, ValueDecl *decl,
3797
+ ConstraintLocator *locator);
3798
+
3799
+ static bool classof (const ConstraintFix *fix) {
3800
+ return fix->getKind () == FixKind::AllowMacroSpecialization;
3801
+ }
3802
+ };
3803
+
3746
3804
class IgnoreOutOfPlaceThenStmt final : public ConstraintFix {
3747
3805
IgnoreOutOfPlaceThenStmt (ConstraintSystem &cs, ConstraintLocator *locator)
3748
3806
: ConstraintFix(cs, FixKind::IgnoreOutOfPlaceThenStmt, locator) {}
0 commit comments