mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Put SIL diagnostics involving Embedded Swift restrictions into the appropriate group
Embedded Swift must defer some of the diagnostics about its restrictions to late in the optimization pipeline, because some source-level constructs (such as metatypes) are allowed in specific cases that cannot be diagnosed in the type checker. Put these diagnostics into the same EmbeddedRestrictions diagnostic group as the type checker diagnostics, because that's the central point at which we can direct folks to more information about the restrictions in Embedded Swift. Addresses rdar://119383905.
This commit is contained in:
@@ -378,32 +378,48 @@ ERROR(bad_attr_on_non_const_global,none,
|
||||
"global variable must be a compile-time constant to use %0 attribute", (StringRef))
|
||||
ERROR(global_must_be_compile_time_const,none,
|
||||
"global variable must be a compile-time constant", ())
|
||||
ERROR(embedded_cannot_specialize_class_method,none,
|
||||
"classes cannot have a non-final, generic method %0 in embedded Swift", (DeclName))
|
||||
ERROR(embedded_cannot_specialize_witness_method,none,
|
||||
"a protocol type cannot contain a generic method %0 in embedded Swift", (DeclName))
|
||||
ERROR(cannot_specialize_class,none,
|
||||
"cannot specialize %0 because class definition is not available (make sure to build with -wmo)", (Type))
|
||||
ERROR(embedded_swift_existential_type,none,
|
||||
"cannot use a value of protocol type %0 in embedded Swift", (Type))
|
||||
ERROR(embedded_swift_existential_protocol,none,
|
||||
"cannot use a value of protocol type 'any %0' in embedded Swift", (StringRef))
|
||||
ERROR(embedded_swift_existential,none,
|
||||
"cannot use a value of protocol type in embedded Swift", ())
|
||||
ERROR(perf_diag_existential_type,none,
|
||||
"cannot use a value of protocol type %0 in '@_noExistential' function", (Type))
|
||||
ERROR(perf_diag_existential,none,
|
||||
"cannot use a value of protocol type in '@_noExistential' function", ())
|
||||
ERROR(embedded_swift_value_deinit,none,
|
||||
|
||||
// Embedded Swift diagnostics
|
||||
GROUPED_ERROR(embedded_cannot_specialize_class_method,EmbeddedRestrictions,none,
|
||||
"classes cannot have a non-final, generic method %0 in embedded Swift", (DeclName))
|
||||
GROUPED_ERROR(embedded_cannot_specialize_witness_method,EmbeddedRestrictions,none,
|
||||
"a protocol type cannot contain a generic method %0 in embedded Swift", (DeclName))
|
||||
GROUPED_ERROR(cannot_specialize_class,EmbeddedRestrictions,none,
|
||||
"cannot specialize %0 because class definition is not available (make sure to build with -wmo)", (Type))
|
||||
GROUPED_ERROR(embedded_swift_existential_type,EmbeddedRestrictions,none,
|
||||
"cannot use a value of protocol type %0 in embedded Swift", (Type))
|
||||
GROUPED_ERROR(embedded_swift_existential_protocol,EmbeddedRestrictions,none,
|
||||
"cannot use a value of protocol type 'any %0' in embedded Swift", (StringRef))
|
||||
GROUPED_ERROR(embedded_swift_existential,EmbeddedRestrictions,none,
|
||||
"cannot use a value of protocol type in embedded Swift", ())
|
||||
GROUPED_ERROR(embedded_swift_value_deinit,EmbeddedRestrictions,none,
|
||||
"cannot de-virtualize deinit of type %0", (Type))
|
||||
ERROR(embedded_swift_metatype_type,none,
|
||||
GROUPED_ERROR(embedded_swift_metatype_type,EmbeddedRestrictions,none,
|
||||
"cannot use metatype of type %0 in embedded Swift", (Type))
|
||||
ERROR(embedded_swift_metatype,none,
|
||||
GROUPED_ERROR(embedded_swift_metatype,EmbeddedRestrictions,none,
|
||||
"cannot use metatype in embedded Swift", ())
|
||||
ERROR(embedded_swift_keypath,none,
|
||||
GROUPED_ERROR(embedded_swift_keypath,EmbeddedRestrictions,none,
|
||||
"cannot use key path in embedded Swift", ())
|
||||
ERROR(embedded_swift_dynamic_cast,none,
|
||||
GROUPED_ERROR(embedded_swift_dynamic_cast,EmbeddedRestrictions,none,
|
||||
"cannot do dynamic casting in embedded Swift", ())
|
||||
GROUPED_ERROR(embedded_capture_of_generic_value_with_deinit,EmbeddedRestrictions,none,
|
||||
"capturing generic non-copyable type with deinit in escaping closure not supported in embedded Swift", ())
|
||||
GROUPED_ERROR(embedded_call_generic_function,EmbeddedRestrictions,none,
|
||||
"cannot specialize generic function or default protocol method in this context", ())
|
||||
GROUPED_ERROR(embedded_call_generic_function_with_dynamic_self,EmbeddedRestrictions,none,
|
||||
"cannot call an initializer or static method, which is defined as default protocol method, from a class method or initializer", ())
|
||||
NOTE(embedded_specialization_called_from,none,
|
||||
"generic specialization called here", ())
|
||||
NOTE(embedded_existential_created,none,
|
||||
"protocol type value created here", ())
|
||||
NOTE(embedded_constructor_called,none,
|
||||
"instance of type created here", ())
|
||||
|
||||
// no-allocations diagnostics
|
||||
ERROR(embedded_swift_allocating_type,none,
|
||||
"cannot use allocating type %0 in -no-allocations mode", (Type))
|
||||
ERROR(embedded_swift_allocating_coroutine,none,
|
||||
@@ -412,18 +428,7 @@ ERROR(embedded_swift_allocating_closure,none,
|
||||
"cannot use escaping closures in -no-allocations mode", ())
|
||||
ERROR(embedded_swift_allocating,none,
|
||||
"cannot use allocating operation in -no-allocations mode", ())
|
||||
ERROR(embedded_capture_of_generic_value_with_deinit,none,
|
||||
"capturing generic non-copyable type with deinit in escaping closure not supported in embedded Swift", ())
|
||||
ERROR(embedded_call_generic_function,none,
|
||||
"cannot specialize generic function or default protocol method in this context", ())
|
||||
ERROR(embedded_call_generic_function_with_dynamic_self,none,
|
||||
"cannot call an initializer or static method, which is defined as default protocol method, from a class method or initializer", ())
|
||||
NOTE(embedded_specialization_called_from,none,
|
||||
"generic specialization called here", ())
|
||||
NOTE(embedded_existential_created,none,
|
||||
"protocol type value created here", ())
|
||||
NOTE(embedded_constructor_called,none,
|
||||
"instance of type created here", ())
|
||||
|
||||
ERROR(wrong_linkage_for_serialized_function,none,
|
||||
"function has wrong linkage to be called from %0", (StringRef))
|
||||
NOTE(performance_called_from,none,
|
||||
|
||||
Reference in New Issue
Block a user