@@ -462,9 +462,12 @@ 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
+
468
471
// / Ignore an out-of-place \c then statement.
469
472
IgnoreOutOfPlaceThenStmt,
470
473
@@ -3718,11 +3721,14 @@ class AllowInvalidMemberReferenceInInitAccessor final : public ConstraintFix {
3718
3721
3719
3722
class AllowConcreteTypeSpecialization final : public ConstraintFix {
3720
3723
Type ConcreteType;
3724
+ ValueDecl *Decl;
3721
3725
3722
3726
AllowConcreteTypeSpecialization (ConstraintSystem &cs, Type concreteTy,
3723
- ConstraintLocator *locator)
3724
- : ConstraintFix(cs, FixKind::AllowConcreteTypeSpecialization, locator),
3725
- ConcreteType (concreteTy) {}
3727
+ ValueDecl *decl, ConstraintLocator *locator,
3728
+ FixBehavior fixBehavior)
3729
+ : ConstraintFix(cs, FixKind::AllowConcreteTypeSpecialization, locator,
3730
+ fixBehavior),
3731
+ ConcreteType (concreteTy), Decl(decl) {}
3726
3732
3727
3733
public:
3728
3734
std::string getName () const override {
@@ -3736,13 +3742,41 @@ class AllowConcreteTypeSpecialization final : public ConstraintFix {
3736
3742
}
3737
3743
3738
3744
static AllowConcreteTypeSpecialization *
3739
- create (ConstraintSystem &cs, Type concreteTy, ConstraintLocator *locator);
3745
+ create (ConstraintSystem &cs, Type concreteTy, ValueDecl *decl,
3746
+ ConstraintLocator *locator, FixBehavior fixBehavior);
3740
3747
3741
3748
static bool classof (const ConstraintFix *fix) {
3742
3749
return fix->getKind () == FixKind::AllowConcreteTypeSpecialization;
3743
3750
}
3744
3751
};
3745
3752
3753
+ class AllowGenericFunctionSpecialization final : public ConstraintFix {
3754
+ ValueDecl *Decl;
3755
+
3756
+ AllowGenericFunctionSpecialization (ConstraintSystem &cs, ValueDecl *decl,
3757
+ ConstraintLocator *locator)
3758
+ : ConstraintFix(cs, FixKind::AllowGenericFunctionSpecialization, locator),
3759
+ Decl (decl) {}
3760
+
3761
+ public:
3762
+ std::string getName () const override {
3763
+ return " allow generic function specialization" ;
3764
+ }
3765
+
3766
+ bool diagnose (const Solution &solution, bool asNote = false ) const override ;
3767
+
3768
+ bool diagnoseForAmbiguity (CommonFixesArray commonFixes) const override {
3769
+ return diagnose (*commonFixes.front ().first );
3770
+ }
3771
+
3772
+ static AllowGenericFunctionSpecialization *
3773
+ create (ConstraintSystem &cs, ValueDecl *decl, ConstraintLocator *locator);
3774
+
3775
+ static bool classof (const ConstraintFix *fix) {
3776
+ return fix->getKind () == FixKind::AllowGenericFunctionSpecialization;
3777
+ }
3778
+ };
3779
+
3746
3780
class IgnoreOutOfPlaceThenStmt final : public ConstraintFix {
3747
3781
IgnoreOutOfPlaceThenStmt (ConstraintSystem &cs, ConstraintLocator *locator)
3748
3782
: ConstraintFix(cs, FixKind::IgnoreOutOfPlaceThenStmt, locator) {}
0 commit comments