@@ -365,6 +365,10 @@ enum class FixKind : uint8_t {
365
365
// / Ignore either capability (read/write) or type mismatch in conversion
366
366
// / between two key path types.
367
367
IgnoreKeyPathContextualMismatch,
368
+
369
+ // / Ignore a type mismatch between deduced element type and externally
370
+ // / imposed one.
371
+ IgnoreCollectionElementContextualMismatch,
368
372
};
369
373
370
374
class ConstraintFix {
@@ -1845,7 +1849,9 @@ class RemoveReturn final : public ContextualMismatch {
1845
1849
class CollectionElementContextualMismatch final : public ContextualMismatch {
1846
1850
CollectionElementContextualMismatch (ConstraintSystem &cs, Type srcType,
1847
1851
Type dstType, ConstraintLocator *locator)
1848
- : ContextualMismatch(cs, srcType, dstType, locator) {}
1852
+ : ContextualMismatch(cs,
1853
+ FixKind::IgnoreCollectionElementContextualMismatch,
1854
+ srcType, dstType, locator) {}
1849
1855
1850
1856
public:
1851
1857
std::string getName () const override {
@@ -1857,6 +1863,10 @@ class CollectionElementContextualMismatch final : public ContextualMismatch {
1857
1863
static CollectionElementContextualMismatch *
1858
1864
create (ConstraintSystem &cs, Type srcType, Type dstType,
1859
1865
ConstraintLocator *locator);
1866
+
1867
+ static bool classof (ConstraintFix *fix) {
1868
+ return fix->getKind () == FixKind::IgnoreCollectionElementContextualMismatch;
1869
+ }
1860
1870
};
1861
1871
1862
1872
class DefaultGenericArgument final : public ConstraintFix {
0 commit comments