@@ -425,6 +425,9 @@ enum class FixKind : uint8_t {
425425
426426 // / Produce an error about a type that must be Copyable
427427 MustBeCopyable,
428+
429+ // / Allow 'each' applied to a non-pack type.
430+ AllowInvalidPackElement,
428431};
429432
430433class ConstraintFix {
@@ -2061,6 +2064,30 @@ class MustBeCopyable final : public ConstraintFix {
20612064 }
20622065};
20632066
2067+ class AllowInvalidPackElement final : public ConstraintFix {
2068+ Type packElementType;
2069+
2070+ AllowInvalidPackElement (ConstraintSystem &cs, Type packElementType,
2071+ ConstraintLocator *locator)
2072+ : ConstraintFix(cs, FixKind::AllowInvalidPackElement, locator),
2073+ packElementType (packElementType) {}
2074+
2075+ public:
2076+ std::string getName () const override {
2077+ return " allow concrete pack element" ;
2078+ }
2079+
2080+ bool diagnose (const Solution &solution, bool asNote = false ) const override ;
2081+
2082+ static AllowInvalidPackElement *create (ConstraintSystem &cs,
2083+ Type packElementType,
2084+ ConstraintLocator *locator);
2085+
2086+ static bool classof (ConstraintFix const * fix) {
2087+ return fix->getKind () == FixKind::AllowInvalidPackElement;
2088+ }
2089+ };
2090+
20642091class CollectionElementContextualMismatch final
20652092 : public ContextualMismatch,
20662093 private llvm::TrailingObjects<CollectionElementContextualMismatch,
0 commit comments