@@ -585,26 +585,6 @@ class LabelingFailure final : public FailureDiagnostic {
585
585
bool diagnoseAsNote () override ;
586
586
};
587
587
588
- // / Diagnose errors related to converting function type which
589
- // / isn't explicitly '@escaping' to some other type.
590
- class NoEscapeFuncToTypeConversionFailure final : public FailureDiagnostic {
591
- Type ConvertTo;
592
-
593
- public:
594
- NoEscapeFuncToTypeConversionFailure (ConstraintSystem &cs,
595
- ConstraintLocator *locator,
596
- Type toType = Type())
597
- : FailureDiagnostic(cs, locator), ConvertTo(toType) {}
598
-
599
- bool diagnoseAsError () override ;
600
-
601
- private:
602
- // / Emit tailored diagnostics for no-escape parameter conversions e.g.
603
- // / passing such parameter as an @escaping argument, or trying to
604
- // / assign it to a variable which expects @escaping function.
605
- bool diagnoseParameterUse () const ;
606
- };
607
-
608
588
// / Diagnose failures related to attempting member access on optional base
609
589
// / type without optional chaining or force-unwrapping it first.
610
590
class MemberAccessOnOptionalBaseFailure final : public FailureDiagnostic {
@@ -819,6 +799,23 @@ class ContextualFailure : public FailureDiagnostic {
819
799
getDiagnosticFor (ContextualTypePurpose context, bool forProtocol);
820
800
};
821
801
802
+ // / Diagnose errors related to converting function type which
803
+ // / isn't explicitly '@escaping' to some other type.
804
+ class NoEscapeFuncToTypeConversionFailure final : public ContextualFailure {
805
+ public:
806
+ NoEscapeFuncToTypeConversionFailure (ConstraintSystem &cs, Type fromType,
807
+ Type toType, ConstraintLocator *locator)
808
+ : ContextualFailure(cs, fromType, toType, locator) {}
809
+
810
+ bool diagnoseAsError () override ;
811
+
812
+ private:
813
+ // / Emit tailored diagnostics for no-escape parameter conversions e.g.
814
+ // / passing such parameter as an @escaping argument, or trying to
815
+ // / assign it to a variable which expects @escaping function.
816
+ bool diagnoseParameterUse () const ;
817
+ };
818
+
822
819
// / Diagnose failures related to use of the unwrapped optional types,
823
820
// / which require some type of force-unwrap e.g. "!" or "try!".
824
821
class MissingOptionalUnwrapFailure final : public ContextualFailure {
0 commit comments