Skip to content

Commit d9e2bcd

Browse files
committed
Mark deprecation/no-usage diagnostics
1 parent 9a86d2e commit d9e2bcd

File tree

2 files changed

+47
-47
lines changed

2 files changed

+47
-47
lines changed

include/swift/AST/DiagnosticsParse.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1753,7 +1753,7 @@ ERROR(version_component_not_number,none,
17531753
"version component contains non-numeric characters", ())
17541754
ERROR(compiler_version_too_many_components,none,
17551755
"compiler version must not have more than five components", ())
1756-
WARNING(unused_compiler_version_component,none,
1756+
WARNING(unused_compiler_version_component,NoUsage,
17571757
"the second version component is not used for comparison", ())
17581758
ERROR(empty_version_component,none,
17591759
"found empty version component", ())

include/swift/AST/DiagnosticsSema.def

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -572,12 +572,12 @@ NOTE(async_inferred_from_operation,none,
572572
// Key-path expressions.
573573
ERROR(expr_keypath_no_objc_runtime,none,
574574
"'#keyPath' can only be used with the Objective-C runtime", ())
575-
ERROR(expression_unused_keypath_result,none,
575+
ERROR(expression_unused_keypath_result,NoUsage,
576576
"result of key path is unused", ())
577577
ERROR(expr_keypath_non_objc_property,none,
578578
"argument of '#keyPath' refers to non-'@objc' property %0",
579579
(Identifier))
580-
WARNING(expr_keypath_swift3_objc_inference,none,
580+
WARNING(expr_keypath_swift3_objc_inference,Deprecation,
581581
"argument of '#keyPath' refers to property %0 in %1 that depends on "
582582
"'@objc' inference deprecated in Swift 4",
583583
(Identifier, Identifier))
@@ -637,7 +637,7 @@ ERROR(expr_swift_keypath_anyobject_root,none,
637637
"the root type of a Swift key path cannot be 'AnyObject'", ())
638638
ERROR(expr_keypath_multiparam_func_conversion, none,
639639
"cannot convert key path into a multi-argument function type %0", (Type))
640-
WARNING(expr_deprecated_writable_keypath,none,
640+
WARNING(expr_deprecated_writable_keypath,Deprecation,
641641
"forming a writable keypath to property %0 that is read-only in this context "
642642
"is deprecated and will be removed in a future release",(DeclName))
643643

@@ -680,7 +680,7 @@ ERROR(expr_selector_not_objc,none,
680680
NOTE(make_decl_objc,none,
681681
"add '@objc' to expose this %0 to Objective-C",
682682
(DescriptiveDeclKind))
683-
WARNING(expr_selector_swift3_objc_inference,none,
683+
WARNING(expr_selector_swift3_objc_inference,Deprecation,
684684
"argument of '#selector' refers to %0 %1 in %2 that depends on "
685685
"'@objc' inference deprecated in Swift 4",
686686
(DescriptiveDeclKind, DeclName, Identifier))
@@ -690,10 +690,10 @@ WARNING(selector_literal_invalid,none,
690690
"string literal is not a valid Objective-C selector", ())
691691
WARNING(selector_literal_undeclared,none,
692692
"no method declared with Objective-C selector %0", (ObjCSelector))
693-
WARNING(selector_literal_deprecated,none,
693+
WARNING(selector_literal_deprecated,Deprecation,
694694
"use of string literal for Objective-C selectors is deprecated; "
695695
"use '#selector' or explicitly construct a 'Selector'", ())
696-
WARNING(selector_literal_deprecated_suggest,none,
696+
WARNING(selector_literal_deprecated_suggest,Deprecation,
697697
"use of string literal for Objective-C selectors is deprecated; "
698698
"use '#selector' instead", ())
699699
WARNING(selector_construction_suggest,none,
@@ -828,7 +828,7 @@ ERROR(invalid_redecl_implicit,none,
828828
"invalid redeclaration of synthesized "
829829
"%select{%0|implementation for protocol requirement}1 %2",
830830
(DescriptiveDeclKind, bool, DeclName))
831-
WARNING(invalid_redecl_swift5_warning,none,
831+
WARNING(invalid_redecl_swift5_warning,Deprecation,
832832
"redeclaration of %0 is deprecated and will be an error in Swift 5",
833833
(DeclName))
834834

@@ -1271,7 +1271,7 @@ ERROR(extra_trailing_closure_in_call,none,
12711271
ERROR(trailing_closure_bad_param,none,
12721272
"trailing closure passed to parameter of type %0 that does not "
12731273
"accept a closure", (Type))
1274-
WARNING(unlabeled_trailing_closure_deprecated,none,
1274+
WARNING(unlabeled_trailing_closure_deprecated,Deprecation,
12751275
"backward matching of the unlabeled trailing closure is deprecated; label the argument with %0 to suppress this warning",
12761276
(Identifier))
12771277
NOTE(decl_multiple_defaulted_closure_parameters,none,
@@ -1551,7 +1551,7 @@ ERROR(missing_unimplemented_init_runtime,none,
15511551
ERROR(missing_undefined_runtime,none,
15521552
"standard library error: missing _undefined", ())
15531553

1554-
WARNING(expr_dynamic_lookup_swift3_objc_inference,none,
1554+
WARNING(expr_dynamic_lookup_swift3_objc_inference,Deprecation,
15551555
"reference to %0 %1 of %2 depends on '@objc' inference "
15561556
"deprecated in Swift 4",
15571557
(DescriptiveDeclKind, DeclName, Identifier))
@@ -2676,7 +2676,7 @@ WARNING(implicitly_final_cannot_be_open_swift4,none,
26762676
"static declarations}0 are implicitly 'final'; use 'public' instead of "
26772677
"'open'", (unsigned))
26782678

2679-
WARNING(override_swift3_objc_inference,none,
2679+
WARNING(override_swift3_objc_inference,Deprecation,
26802680
"override of %0 %1 from extension of %2 depends on deprecated "
26812681
"inference of '@objc'",
26822682
(DescriptiveDeclKind, DeclName, Identifier))
@@ -2692,7 +2692,7 @@ WARNING(duplicate_anyobject_class_inheritance,none,
26922692
"redundant inheritance from 'AnyObject' and Swift 3 'class' keyword", ())
26932693
ERROR(inheritance_from_protocol_with_superclass,none,
26942694
"inheritance from class-constrained protocol composition type %0", (Type))
2695-
WARNING(anyobject_class_inheritance_deprecated,none,
2695+
WARNING(anyobject_class_inheritance_deprecated,Deprecation,
26962696
"using 'class' keyword to define a class-constrained protocol is deprecated; "
26972697
"use 'AnyObject' instead", ())
26982698
ERROR(multiple_inheritance,none,
@@ -3756,12 +3756,12 @@ NOTE(fix_unqualified_access_top_level_multi,none,
37563756
"use '%0' to reference the %1 in module %2",
37573757
(StringRef, DescriptiveDeclKind, Identifier))
37583758

3759-
WARNING(warn_deprecated_conditional_conformance_outer_access,none,
3759+
WARNING(warn_deprecated_conditional_conformance_outer_access,Deprecation,
37603760
"use of %0 as reference to %1 in %2 %3 will change in future versions of Swift to reference %4 in %5 %6 "
37613761
"which comes via a conditional conformance",
37623762
(DeclNameRef, DescriptiveDeclKind, DescriptiveDeclKind, DeclName,
37633763
DescriptiveDeclKind, DescriptiveDeclKind, DeclName))
3764-
NOTE(fix_deprecated_conditional_conformance_outer_access,none,
3764+
NOTE(fix_deprecated_conditional_conformance_outer_access,Deprecation,
37653765
"use '%0' to continue to reference the %1",
37663766
(StringRef, DescriptiveDeclKind, Identifier))
37673767

@@ -3816,7 +3816,7 @@ WARNING(bitcasting_to_change_from_unsized_to_sized_int, none,
38163816
"initializer",
38173817
(Type, Type))
38183818

3819-
WARNING(use_of_qq_on_non_optional_value,none,
3819+
WARNING(use_of_qq_on_non_optional_value,NoUsage,
38203820
"left side of nil coalescing operator '?""?' has non-optional type %0, "
38213821
"so the right side is never used", (Type))
38223822
WARNING(nonoptional_compare_to_nil,none,
@@ -3932,32 +3932,32 @@ WARNING(guard_always_succeeds,none,
39323932
"'guard' condition is always true, body is unreachable", ())
39333933

39343934

3935-
ERROR(expression_unused_closure,none,
3935+
ERROR(expression_unused_closure,NoUsage,
39363936
"closure expression is unused", ())
3937-
ERROR(expression_unused_function,none,
3937+
ERROR(expression_unused_function,NoUsage,
39383938
"function is unused", ())
3939-
WARNING(expression_unused_lvalue,none,
3939+
WARNING(expression_unused_lvalue,NoUsage,
39403940
"%select{"
39413941
"variable|"
39423942
"property is accessed but result|"
39433943
"subscript is accessed but result"
39443944
"}0 is unused",
39453945
(unsigned))
3946-
WARNING(expression_unused_result_call,none,
3946+
WARNING(expression_unused_result_call,NoUsage,
39473947
"result of call to %0 is unused", (DeclName))
3948-
WARNING(expression_unused_result_operator,none,
3948+
WARNING(expression_unused_result_operator,NoUsage,
39493949
"result of operator %0 is unused", (DeclName))
3950-
WARNING(expression_unused_result_unknown, none,
3950+
WARNING(expression_unused_result_unknown, NoUsage,
39513951
"result of call to %select{function|closure}0 returning %1 is unused", (bool, Type))
3952-
WARNING(expression_unused_result, none,
3952+
WARNING(expression_unused_result, NoUsage,
39533953
"expression of type %0 is unused", (Type))
3954-
WARNING(expression_unused_init_result,none,
3954+
WARNING(expression_unused_init_result,NoUsage,
39553955
"result of %0 initializer is unused", (Type))
3956-
WARNING(expression_unused_optional_try,none,
3956+
WARNING(expression_unused_optional_try,NoUsage,
39573957
"result of 'try?' is unused", ())
3958-
WARNING(expression_unused_selector_result, none,
3958+
WARNING(expression_unused_selector_result, NoUsage,
39593959
"result of '#selector' is unused", ())
3960-
WARNING(expression_unused_literal,none,
3960+
WARNING(expression_unused_literal,NoUsage,
39613961
"%0 literal is unused", (StringRef))
39623962

39633963
ERROR(assignment_lhs_not_lvalue,none,
@@ -4101,7 +4101,7 @@ ERROR(pattern_type_mismatch_context,none,
41014101

41024102
ERROR(tuple_pattern_in_non_tuple_context,none,
41034103
"tuple pattern cannot match values of the non-tuple type %0", (Type))
4104-
WARNING(found_one_pattern_for_several_associated_values,none,
4104+
WARNING(found_one_pattern_for_several_associated_values,Deprecation,
41054105
"enum case '%0' has %1 associated values; matching them as a tuple "
41064106
"is deprecated", (StringRef, unsigned))
41074107
WARNING(converting_tuple_into_several_associated_values,none,
@@ -4646,7 +4646,7 @@ ERROR(enum_element_ellipsis,none,
46464646
WARNING(implicitly_unwrapped_optional_in_illegal_position_interpreted_as_optional,none,
46474647
"using '!' is not allowed here; treating this as '?' instead", ())
46484648

4649-
WARNING(implicitly_unwrapped_optional_deprecated_in_this_position,none,
4649+
WARNING(implicitly_unwrapped_optional_deprecated_in_this_position,Deprecation,
46504650
"using '!' here is deprecated and will be removed in a future release", ())
46514651

46524652
ERROR(implicitly_unwrapped_optional_in_illegal_position,none,
@@ -4710,7 +4710,7 @@ ERROR(attribute_requires_function_type,none,
47104710
"@%0 attribute only applies to function types", (StringRef))
47114711
ERROR(unsupported_convention,none,
47124712
"convention '%0' not supported", (StringRef))
4713-
ERROR(unreferenced_generic_parameter,none,
4713+
ERROR(unreferenced_generic_parameter,NoUsage,
47144714
"generic parameter '%0' is not used in function signature", (StringRef))
47154715
ERROR(unexpected_ctype_for_non_c_convention,none,
47164716
"convention '%0' does not support the 'cType' argument label, did you "
@@ -4825,9 +4825,9 @@ ERROR(objc_operator, none,
48254825
"operator methods cannot be declared @objc", ())
48264826
ERROR(objc_operator_proto, none,
48274827
"@objc protocols must not have operator requirements", ())
4828-
WARNING(objc_inference_swift3_dynamic,none,
4828+
WARNING(objc_inference_swift3_dynamic,Deprecation,
48294829
"inference of '@objc' for 'dynamic' members is deprecated", ())
4830-
WARNING(objc_inference_swift3_objc_derived,none,
4830+
WARNING(objc_inference_swift3_objc_derived,Deprecation,
48314831
"inference of '@objc' for members of Objective-C-derived classes is "
48324832
"deprecated", ())
48334833

@@ -4852,7 +4852,7 @@ ERROR(objc_setter_for_nonobjc_property,none,
48524852
"'@objc' setter for non-'@objc' property", ())
48534853
ERROR(objc_setter_for_nonobjc_subscript,none,
48544854
"'@objc' setter for non-'@objc' subscript", ())
4855-
WARNING(accessor_swift3_objc_inference,none,
4855+
WARNING(accessor_swift3_objc_inference,Deprecation,
48564856
"%select{%0 %1|%1}2 with '@objc' %select{getter|setter}3 depends on "
48574857
"deprecated inference of '@objc'",
48584858
(DescriptiveDeclKind, DeclName, bool, bool))
@@ -4947,7 +4947,7 @@ NOTE(objc_overriding_objc_decl,none,
49474947
NOTE(objc_witness_objc_requirement,none,
49484948
"satisfying requirement for %0 %1 in protocol %2",
49494949
(DescriptiveDeclKind, DeclName, Identifier))
4950-
WARNING(witness_swift3_objc_inference,none,
4950+
WARNING(witness_swift3_objc_inference,Deprecation,
49514951
"use of %0 %1 to satisfy a requirement of protocol %2 depends on "
49524952
"'@objc' inference deprecated in Swift 4",
49534953
(DescriptiveDeclKind, DeclName, Type))
@@ -5229,13 +5229,13 @@ NOTE(availability_obsoleted, none,
52295229
"%select{getter for |setter for |}0%1 was obsoleted in %2 %3",
52305230
(unsigned, DeclName, StringRef, llvm::VersionTuple))
52315231

5232-
WARNING(availability_deprecated, none,
5232+
WARNING(availability_deprecated, Deprecation,
52335233
"%select{getter for |setter for |}0%1 %select{is|%select{is|was}4}2 "
52345234
"deprecated%select{| in %3%select{| %5}4}2%select{|: %6}6",
52355235
(unsigned, DeclName, bool, StringRef, bool, llvm::VersionTuple,
52365236
StringRef))
52375237

5238-
WARNING(availability_deprecated_rename, none,
5238+
WARNING(availability_deprecated_rename, Deprecation,
52395239
"%select{getter for |setter for |}0%1 %select{is|%select{is|was}4}2 "
52405240
"deprecated%select{| in %3%select{| %5}4}2: "
52415241
"%select{renamed to|replaced by}6%" REPLACEMENT_DECL_KIND_SELECT "7 "
@@ -5244,7 +5244,7 @@ WARNING(availability_deprecated_rename, none,
52445244
unsigned, StringRef))
52455245
#undef REPLACEMENT_DECL_KIND_SELECT
52465246

5247-
NOTE(note_deprecated_rename, none,
5247+
NOTE(note_deprecated_rename, Deprecation,
52485248
"use '%0' instead", (StringRef))
52495249

52505250
ERROR(availability_decl_more_than_enclosing, none,
@@ -5347,7 +5347,7 @@ NOTE(conformance_availability_obsoleted, none,
53475347
"conformance of %0 to %1 was obsoleted in %2 %3",
53485348
(Type, Type, StringRef, llvm::VersionTuple))
53495349

5350-
WARNING(conformance_availability_deprecated, none,
5350+
WARNING(conformance_availability_deprecated, Deprecation,
53515351
"conformance of %0 to %1 %select{is|%select{is|was}4}2 "
53525352
"deprecated%select{| in %3%select{| %5}4}2%select{|: %6}6",
53535353
(Type, Type, bool, StringRef, bool, llvm::VersionTuple,
@@ -5493,31 +5493,31 @@ NOTE(specialize_found_function_of_type, none,
54935493
// MARK: Variable usage diagnostics
54945494
//------------------------------------------------------------------------------
54955495

5496-
WARNING(pbd_never_used_stmtcond, none,
5496+
WARNING(pbd_never_used_stmtcond, NoUsage,
54975497
"value %0 was defined but never used; consider replacing "
54985498
"with boolean test",
54995499
(Identifier))
5500-
WARNING(unused_setter_parameter, none,
5500+
WARNING(unused_setter_parameter, NoUsage,
55015501
"setter argument %0 was never used, but the property was accessed",
55025502
(Identifier))
55035503
NOTE(fixit_for_unused_setter_parameter, none,
55045504
"did you mean to use %0 instead of accessing the property's current value?", (Identifier))
55055505

5506-
WARNING(pbd_never_used, none,
5506+
WARNING(pbd_never_used, NoUsage,
55075507
"initialization of %select{variable|immutable value}1 %0 was never used"
55085508
"; consider replacing with assignment to '_' or removing it",
55095509
(Identifier, unsigned))
55105510

55115511

5512-
WARNING(capture_never_used, none,
5512+
WARNING(capture_never_used, NoUsage,
55135513
"capture %0 was never used",
55145514
(Identifier))
55155515

5516-
WARNING(variable_never_used, none,
5516+
WARNING(variable_never_used, NoUsage,
55175517
"%select{variable|immutable value}1 %0 was never used; "
55185518
"consider replacing with '_' or removing it",
55195519
(Identifier, unsigned))
5520-
WARNING(immutable_value_never_used_but_assigned, none,
5520+
WARNING(immutable_value_never_used_but_assigned, NoUsage,
55215521
"immutable value %0 was never used; consider removing it",
55225522
(Identifier))
55235523
WARNING(variable_never_mutated, none,
@@ -5602,7 +5602,7 @@ ERROR(override_nsobject_hash_error,none,
56025602
"'NSObject.hash(into:)' is not overridable; "
56035603
"did you mean to override 'NSObject.hash'?", ())
56045604

5605-
WARNING(hashvalue_implementation,none,
5605+
WARNING(hashvalue_implementation,Deprecation,
56065606
"'Hashable.hashValue' is deprecated as a protocol requirement; "
56075607
"conform type %0 to 'Hashable' by implementing 'hash(into:)' instead",
56085608
(Type))
@@ -5722,10 +5722,10 @@ ERROR(property_wrapper_type_not_usable_from_inline,none,
57225722
"%select{%select{variable|constant}0|property}1 "
57235723
"must be '@usableFromInline' or public",
57245724
(bool, bool))
5725-
WARNING(property_wrapper_wrapperValue,none,
5725+
WARNING(property_wrapper_wrapperValue,Deprecation,
57265726
"property wrapper's 'wrapperValue' property should be renamed to "
57275727
"'projectedValue'; use of 'wrapperValue' is deprecated", ())
5728-
WARNING(property_wrapper_init_initialValue,none,
5728+
WARNING(property_wrapper_init_initialValue,Deprecation,
57295729
"property wrapper's 'init(initialValue:)' should be renamed "
57305730
"to 'init(wrappedValue:)'; use of 'init(initialValue:)' is deprecated",
57315731
())
@@ -5822,7 +5822,7 @@ NOTE(result_builder_missing_build_limited_availability, none,
58225822
// MARK: Tuple Shuffle Diagnostics
58235823
//------------------------------------------------------------------------------
58245824

5825-
WARNING(warn_reordering_tuple_shuffle_deprecated,none,
5825+
WARNING(warn_reordering_tuple_shuffle_deprecated,Deprecation,
58265826
"expression shuffles the elements of this tuple; "
58275827
"this behavior is deprecated", ())
58285828

0 commit comments

Comments
 (0)