@@ -1087,28 +1087,6 @@ AllowInOutConversion *AllowInOutConversion::create(ConstraintSystem &cs,
1087
1087
AllowInOutConversion (cs, argType, paramType, locator);
1088
1088
}
1089
1089
1090
- // / Check whether given `value` type is indeed a the same type as a `RawValue`
1091
- // / type of a given raw representable type.
1092
- static bool isValueOfRawRepresentable (ConstraintSystem &cs,
1093
- Type rawRepresentableType,
1094
- Type valueType) {
1095
- auto rawType = isRawRepresentable (cs, rawRepresentableType);
1096
- if (!rawType)
1097
- return false ;
1098
-
1099
- KnownProtocolKind protocols[] = {
1100
- KnownProtocolKind::ExpressibleByStringLiteral,
1101
- KnownProtocolKind::ExpressibleByIntegerLiteral};
1102
-
1103
- for (auto protocol : protocols) {
1104
- if (conformsToKnownProtocol (cs, valueType, protocol) &&
1105
- valueType->isEqual (rawType))
1106
- return true ;
1107
- }
1108
-
1109
- return false ;
1110
- }
1111
-
1112
1090
ExpandArrayIntoVarargs *
1113
1091
ExpandArrayIntoVarargs::attempt (ConstraintSystem &cs, Type argType,
1114
1092
Type paramType,
@@ -1159,18 +1137,19 @@ ExplicitlyConstructRawRepresentable::create(ConstraintSystem &cs,
1159
1137
ExplicitlyConstructRawRepresentable (cs, rawReprType, valueType, locator);
1160
1138
}
1161
1139
1162
- UseValueTypeOfRawRepresentative *
1163
- UseValueTypeOfRawRepresentative::attempt (ConstraintSystem &cs, Type argType,
1164
- Type paramType,
1165
- ConstraintLocatorBuilder locator) {
1166
- auto rawRepresentableType = argType->lookThroughAllOptionalTypes ();
1167
- auto valueType = paramType->lookThroughAllOptionalTypes ();
1168
-
1169
- if (isValueOfRawRepresentable (cs, rawRepresentableType, valueType))
1170
- return new (cs.getAllocator ()) UseValueTypeOfRawRepresentative (
1171
- cs, rawRepresentableType, valueType, cs.getConstraintLocator (locator));
1140
+ bool UseValueTypeOfRawRepresentative::diagnose (const Solution &solution,
1141
+ bool asNote) const {
1142
+ ArgumentMismatchFailure failure (solution, RawReprType, ValueType,
1143
+ getLocator ());
1144
+ return failure.diagnose (asNote);
1145
+ }
1172
1146
1173
- return nullptr ;
1147
+ UseValueTypeOfRawRepresentative *
1148
+ UseValueTypeOfRawRepresentative::create (ConstraintSystem &cs, Type rawReprType,
1149
+ Type valueType,
1150
+ ConstraintLocator *locator) {
1151
+ return new (cs.getAllocator ())
1152
+ UseValueTypeOfRawRepresentative (cs, rawReprType, valueType, locator);
1174
1153
}
1175
1154
1176
1155
unsigned AllowArgumentMismatch::getParamIdx () const {
0 commit comments