Skip to content

Commit cf15d46

Browse files
committed
Update
1 parent b664a40 commit cf15d46

File tree

3 files changed

+21
-22
lines changed

3 files changed

+21
-22
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ ERROR(could_not_find_imported_enum_case,none,
114114

115115
NOTE(did_you_mean_raw_type,none,
116116
"did you mean to specify a raw type on the enum declaration?", ())
117-
117+
118118
NOTE(did_you_mean_generic_param_as_conformance,none,
119119
"did you mean to declare %0 as a protocol conformance for %1?", (DeclName, Type))
120120

@@ -1273,7 +1273,7 @@ REMARK(transitive_dependency_behavior,none,
12731273
"%1 has %select{a required|an optional|an ignored}2 "
12741274
"transitive dependency on '%0'",
12751275
(StringRef, Identifier, unsigned))
1276-
1276+
12771277
REMARK(explicit_interface_build_skipped,none,
12781278
"Skipped rebuilding module at %0 - up-to-date",
12791279
(StringRef))
@@ -1527,7 +1527,7 @@ ERROR(optional_self_not_unwrapped,none,
15271527
"to make control flow explicit", ())
15281528
NOTE(optional_self_chain,none,
15291529
"reference 'self?.' explicitly", ())
1530-
1530+
15311531
ERROR(missing_unwrap_optional_try,none,
15321532
"value of optional type %0 not unwrapped; did you mean to use 'try!' "
15331533
"or chain with '?'?",
@@ -1538,7 +1538,7 @@ NOTE(missing_forced_downcast, none,
15381538
"did you mean to use 'as!' to force downcast?", ())
15391539
NOTE(missing_optional_downcast, none,
15401540
"did you mean to use 'as?' to conditionally downcast?", ())
1541-
1541+
15421542
WARNING(coercion_may_fail_warning,none,
15431543
"coercion from %0 to %1 may fail; use 'as?' or 'as!' instead",
15441544
(Type, Type))
@@ -3984,7 +3984,7 @@ NOTE(automatic_protocol_synthesis_unsupported,none,
39843984
"automatic synthesis of %0 is not supported for %kindonly1 declarations",
39853985
(const ProtocolDecl *, const NominalTypeDecl *))
39863986
NOTE(comparable_synthesis_raw_value_not_allowed, none,
3987-
"enum declares raw type %0, preventing synthesized conformance of %1 to %2",
3987+
"enum declares raw type %0, preventing synthesized conformance of %1 to %2",
39883988
(Type, Type, Type))
39893989

39903990
// Dynamic Self
@@ -4232,7 +4232,7 @@ ERROR(attr_rawlayout_cannot_have_alignment_attr,none,
42324232
"type with @_rawLayout cannot also have an @_alignment attribute", ())
42334233
ERROR(attr_rawlayout_invalid_count_type,none,
42344234
"@_rawLayout count must either be integer literal or a generic argument", ())
4235-
4235+
42364236
// lazy
42374237
ERROR(lazy_not_on_let,none,
42384238
"'lazy' cannot be used on a let", ())
@@ -4576,15 +4576,15 @@ ERROR(unordered_adjacent_operators,none,
45764576
ERROR(missing_builtin_precedence_group,none,
45774577
"broken standard library: missing builtin precedence group %0",
45784578
(Identifier))
4579-
WARNING(nan_comparison, none,
4579+
WARNING(nan_comparison, none,
45804580
"comparison with '.nan' using %0 is always %select{false|true}1, use "
45814581
"'%2.isNaN' to check if '%3' %select{is not a number|is a number}1",
45824582
(Identifier, bool, StringRef, StringRef))
4583-
WARNING(nan_comparison_without_isnan, none,
4584-
"comparison with '.nan' using %0 is always %select{false|true}1",
4583+
WARNING(nan_comparison_without_isnan, none,
4584+
"comparison with '.nan' using %0 is always %select{false|true}1",
45854585
(Identifier, bool))
4586-
WARNING(nan_comparison_both_nan, none,
4587-
"'.nan' %0 '.nan' is always %select{false|true}1",
4586+
WARNING(nan_comparison_both_nan, none,
4587+
"'.nan' %0 '.nan' is always %select{false|true}1",
45884588
(StringRef, bool))
45894589

45904590
// If you change this, also change enum TryKindForDiagnostics.
@@ -4672,7 +4672,7 @@ ERROR(could_not_infer_pack_element,none,
46724672
NOTE(note_in_opening_pack_element,none,
46734673
"in inferring pack element #%0 of '%1'", (unsigned,StringRef))
46744674

4675-
4675+
46764676
ERROR(type_of_expression_is_ambiguous,none,
46774677
"type of expression is ambiguous without a type annotation", ())
46784678

@@ -4728,7 +4728,7 @@ ERROR(should_use_empty_dictionary_literal,none,
47284728
WARNING(duplicated_literal_keys_in_dictionary_literal, none,
47294729
"dictionary literal of type %0 has duplicate entries for %1 literal key%select{ %3|}2",
47304730
(Type, StringRef, bool, StringRef))
4731-
NOTE(duplicated_key_declared_here, none,
4731+
NOTE(duplicated_key_declared_here, none,
47324732
"duplicate key declared here", ())
47334733

47344734
// Generic specializations
@@ -5462,7 +5462,7 @@ ERROR(thrown_type_not_error,none,
54625462
"thrown type %0 does not conform to the 'Error' protocol", (Type))
54635463

54645464
ERROR(typed_thrown_in_objc_forbidden,none,
5465-
"typed throw can't be applied to @objc functions", ())
5465+
"@objc functions cannot have typed throw", ())
54665466

54675467
//------------------------------------------------------------------------------
54685468
// MARK: Concurrency
@@ -5603,7 +5603,7 @@ NOTE(property_requires_actor,none,
56035603
"initializer for %kind0 is %1",
56045604
(const VarDecl *, ActorIsolation))
56055605
ERROR(isolated_default_argument_context,none,
5606-
"%0 default value in a %1 context",
5606+
"%0 default value in a %1 context",
56075607
(ActorIsolation, ActorIsolation))
56085608
ERROR(conflicting_default_argument_isolation,none,
56095609
"default argument cannot be both %0 and %1",
@@ -6359,7 +6359,7 @@ ERROR(differentiable_function_type_void_result,
63596359
"differentiable inout parameter, i.e. a non-'@noDerivative' parameter "
63606360
"whose type conforms to 'Differentiable'",
63616361
())
6362-
ERROR(differentiable_function_type_no_differentiability_parameters,
6362+
ERROR(differentiable_function_type_no_differentiability_parameters,
63636363
none,
63646364
"'@differentiable' function type requires at least one differentiability "
63656365
"parameter, i.e. a non-'@noDerivative' parameter whose type conforms to "
@@ -8357,7 +8357,7 @@ ERROR(safe_and_unsafe_attr,none,
83578357
"%kindbase0 cannot be both @safe and @unsafe", (const Decl *))
83588358

83598359
GROUPED_WARNING(unsafe_superclass,StrictMemorySafety,none,
8360-
"%kindbase0 has superclass involving unsafe type %1",
8360+
"%kindbase0 has superclass involving unsafe type %1",
83618361
(const ValueDecl *, Type))
83628362

83638363
GROUPED_WARNING(conformance_involves_unsafe,StrictMemorySafety,none,
@@ -8674,7 +8674,7 @@ GROUPED_WARNING(
86748674
ERROR(extensible_attr_on_frozen_type,none,
86758675
"cannot use '@extensible' together with '@frozen'", ())
86768676

8677-
ERROR(extensible_attr_on_internal_type,none,
8677+
ERROR(extensible_attr_on_internal_type,none,
86788678
"'@extensible' attribute can only be applied to public or package "
86798679
"declarations, but %0 is "
86808680
"%select{private|fileprivate|internal|%error|%error|%error}1",

lib/Sema/TypeCheckDecl.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2572,9 +2572,8 @@ InterfaceTypeRequest::evaluate(Evaluator &eval, ValueDecl *D) const {
25722572
auto thrownTypeRepr = AFD->getThrownTypeRepr();
25732573
SourceLoc loc =
25742574
(thrownTypeRepr) ? thrownTypeRepr->getLoc() : AFD->getLoc();
2575-
if (AFD->getAttrs().hasAttribute<ObjCAttr>()) {
2576-
Context.Diags.diagnose(loc, diag::typed_thrown_in_objc_forbidden,
2577-
thrownTy);
2575+
if (AFD->getAttrs().hasAttribute<ObjCAttr>() && thrownTy) {
2576+
Context.Diags.diagnose(loc, diag::typed_thrown_in_objc_forbidden);
25782577
} else if (!checkConformance(thrownTyInContext, errorProto)) {
25792578
Context.Diags.diagnose(loc, diag::thrown_type_not_error, thrownTy);
25802579
}

test/decl/func/typed_throws.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,4 +221,4 @@ enum ObjCError: Int, Error {
221221
case Others
222222
}
223223
@objc func objcTypedThrow() throws(ObjCError) -> () {}
224-
// expected-error@-1 {{typed throw can't be applied to @objc functions}}
224+
// expected-error@-1 {{@objc functions cannot have typed throw}}

0 commit comments

Comments
 (0)