mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Property Wrappers] Add new contextual type purposes for property wrappers
to produce better diagnostics when there's a 'wrappedValue' type mismatch.
This commit is contained in:
@@ -613,6 +613,10 @@ Optional<Diag<Type, Type>> GenericArgumentsMismatchFailure::getDiagnosticFor(
|
||||
return diag::cannot_convert_subscript_assign;
|
||||
case CTP_Condition:
|
||||
return diag::cannot_convert_condition_value;
|
||||
case CTP_WrappedProperty:
|
||||
return diag::wrapped_value_mismatch;
|
||||
case CTP_ComposedPropertyWrapper:
|
||||
return diag::composed_property_wrapper_mismatch;
|
||||
|
||||
case CTP_ThrowStmt:
|
||||
case CTP_ForEachStmt:
|
||||
@@ -2206,6 +2210,8 @@ getContextualNilDiagnostic(ContextualTypePurpose CTP) {
|
||||
case CTP_ThrowStmt:
|
||||
case CTP_ForEachStmt:
|
||||
case CTP_YieldByReference:
|
||||
case CTP_WrappedProperty:
|
||||
case CTP_ComposedPropertyWrapper:
|
||||
return None;
|
||||
|
||||
case CTP_EnumCaseRawValue:
|
||||
@@ -2904,6 +2910,11 @@ ContextualFailure::getDiagnosticFor(ContextualTypePurpose context,
|
||||
case CTP_Condition:
|
||||
return diag::cannot_convert_condition_value;
|
||||
|
||||
case CTP_WrappedProperty:
|
||||
return diag::wrapped_value_mismatch;
|
||||
case CTP_ComposedPropertyWrapper:
|
||||
return diag::composed_property_wrapper_mismatch;
|
||||
|
||||
case CTP_ThrowStmt:
|
||||
case CTP_ForEachStmt:
|
||||
case CTP_Unused:
|
||||
|
||||
Reference in New Issue
Block a user