@@ -382,6 +382,10 @@ enum class FixKind : uint8_t {
382382
383383 // / Produce an error for not getting a compile-time constant
384384 NotCompileTimeConst,
385+
386+ // / Ignore a type mismatch while trying to infer generic parameter type
387+ // / from default expression.
388+ IgnoreDefaultExprTypeMismatch,
385389};
386390
387391class ConstraintFix {
@@ -2896,6 +2900,29 @@ class AllowSwiftToCPointerConversion final : public ConstraintFix {
28962900 ConstraintLocator *locator);
28972901};
28982902
2903+ class IgnoreDefaultExprTypeMismatch : public AllowArgumentMismatch {
2904+ protected:
2905+ IgnoreDefaultExprTypeMismatch (ConstraintSystem &cs, Type argType,
2906+ Type paramType, ConstraintLocator *locator)
2907+ : AllowArgumentMismatch(cs, FixKind::IgnoreDefaultExprTypeMismatch,
2908+ argType, paramType, locator) {}
2909+
2910+ public:
2911+ std::string getName () const override {
2912+ return " allow default expression conversion mismatch" ;
2913+ }
2914+
2915+ bool diagnose (const Solution &solution, bool asNote = false ) const override ;
2916+
2917+ static IgnoreDefaultExprTypeMismatch *create (ConstraintSystem &cs,
2918+ Type argType, Type paramType,
2919+ ConstraintLocator *locator);
2920+
2921+ static bool classof (const ConstraintFix *fix) {
2922+ return fix->getKind () == FixKind::IgnoreDefaultExprTypeMismatch;
2923+ }
2924+ };
2925+
28992926} // end namespace constraints
29002927} // end namespace swift
29012928
0 commit comments