@@ -357,6 +357,10 @@ enum class FixKind : uint8_t {
357
357
358
358
// / Ignore a type imposed by an assignment destination e.g. `let x: Int = ...`
359
359
IgnoreAssignmentDestinationType,
360
+
361
+ // / Allow argument-to-parameter subtyping even when parameter type
362
+ // / is marked as `inout`.
363
+ AllowConversionThroughInOut,
360
364
};
361
365
362
366
class ConstraintFix {
@@ -1993,7 +1997,8 @@ class IgnoreAssignmentDestinationType final : public ContextualMismatch {
1993
1997
class AllowInOutConversion final : public ContextualMismatch {
1994
1998
AllowInOutConversion (ConstraintSystem &cs, Type argType, Type paramType,
1995
1999
ConstraintLocator *locator)
1996
- : ContextualMismatch(cs, argType, paramType, locator) {}
2000
+ : ContextualMismatch(cs, FixKind::AllowConversionThroughInOut, argType,
2001
+ paramType, locator) {}
1997
2002
1998
2003
public:
1999
2004
std::string getName () const override {
@@ -2005,6 +2010,10 @@ class AllowInOutConversion final : public ContextualMismatch {
2005
2010
static AllowInOutConversion *create (ConstraintSystem &cs, Type argType,
2006
2011
Type paramType,
2007
2012
ConstraintLocator *locator);
2013
+
2014
+ static bool classof (ConstraintFix *fix) {
2015
+ return fix->getKind () == FixKind::AllowConversionThroughInOut;
2016
+ }
2008
2017
};
2009
2018
2010
2019
class AllowArgumentMismatch : public ContextualMismatch {
0 commit comments