/
DiagnosticsSema.def
3252 lines (2881 loc) · 141 KB
/
DiagnosticsSema.def
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//===--- DiagnosticsSema.def - Diagnostics Text -----------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// This file defines diagnostics emitted during semantic analysis and type
// checking.
// Each diagnostic is described using one of three kinds (error, warning, or
// note) along with a unique identifier, category, options, and text, and is
// followed by a signature describing the diagnostic argument kinds.
//
//===----------------------------------------------------------------------===//
#if !(defined(DIAG) || (defined(ERROR) && defined(WARNING) && defined(NOTE)))
# error Must define either DIAG or the set {ERROR,WARNING,NOTE}
#endif
#ifndef ERROR
# define ERROR(ID,Options,Text,Signature) \
DIAG(ERROR,ID,Options,Text,Signature)
#endif
#ifndef WARNING
# define WARNING(ID,Options,Text,Signature) \
DIAG(WARNING,ID,Options,Text,Signature)
#endif
#ifndef NOTE
# define NOTE(ID,Options,Text,Signature) \
DIAG(NOTE,ID,Options,Text,Signature)
#endif
NOTE(type_declared_here,none,
"type declared here", ())
NOTE(decl_declared_here,none,
"%0 declared here", (DeclName))
NOTE(extended_type_declared_here,none,
"extended type declared here", ())
NOTE(while_converting_default_tuple_value,none,
"while converting default tuple value to element type %0", (Type))
NOTE(while_converting_subscript_index,none,
"while converting subscript index to expected type %0", (Type))
//------------------------------------------------------------------------------
// Constraint solver diagnostics
//------------------------------------------------------------------------------
ERROR(ambiguous_member_overload_set,none,
"ambiguous reference to member %0", (DeclName))
ERROR(ambiguous_subscript,none,
"ambiguous subscript with base type %0 and index type %1",
(Type, Type))
ERROR(type_not_subscriptable,none,
"type %0 has no subscript members",
(Type))
ERROR(could_not_find_tuple_member,none,
"value of tuple type %0 has no member %1", (Type, DeclName))
ERROR(could_not_find_value_member,none,
"value of type %0 has no member %1", (Type, DeclName))
ERROR(could_not_find_type_member,none,
"type %0 has no member %1", (Type, DeclName))
ERROR(could_not_find_enum_case,none,
"enum type %0 has no case %1; did you mean %2", (Type, DeclName, DeclName))
NOTE(did_you_mean_raw_type,none,
"did you mean to specify a raw type on the enum declaration?", ())
NOTE(any_as_anyobject_fixit, none,
"cast 'Any' to 'AnyObject' or use 'as!' to force downcast to a more specific type to access members", ())
ERROR(expected_argument_in_contextual_member,none,
"member %0 expects argument of type %1", (DeclName, Type))
ERROR(expected_parens_in_contextual_member,none,
"member %0 is a function; did you mean to call it?", (DeclName))
ERROR(expected_result_in_contextual_member,none,
"member %0 in %2 produces result of type %1, but context expects %2",
(DeclName, Type, Type))
ERROR(unexpected_argument_in_contextual_member,none,
"member %0 takes no arguments", (DeclName))
ERROR(unexpected_parens_in_contextual_member,none,
"member %0 is not a function", (DeclName))
ERROR(could_not_use_value_member,none,
"member %1 cannot be used on value of type %0", (Type, DeclName))
ERROR(could_not_use_type_member,none,
"member %1 cannot be used on type %0", (Type, DeclName))
ERROR(could_not_use_type_member_on_instance,none,
"static member %1 cannot be used on instance of type %0",
(Type, DeclName))
ERROR(could_not_use_enum_element_on_instance,none,
"enum element %0 cannot be referenced as an instance member",
(DeclName))
ERROR(could_not_use_type_member_on_protocol_metatype,none,
"static member %1 cannot be used on protocol metatype %0",
(Type, DeclName))
ERROR(could_not_use_instance_member_on_type,none,
"instance member %1 cannot be used on type %0",
(Type, DeclName))
ERROR(could_not_use_member_on_existential,none,
"member %1 cannot be used on value of protocol type %0; use a generic"
" constraint instead",
(Type, DeclName))
ERROR(candidate_inaccessible,none,
"%0 is inaccessible due to "
"'%select{private|fileprivate|internal|PUBLIC}1' protection level",
(DeclName, Accessibility))
ERROR(init_candidate_inaccessible,none,
"%0 initializer is inaccessible due to "
"'%select{private|fileprivate|internal|PUBLIC}1' protection level",
(Type, Accessibility))
ERROR(cannot_pass_rvalue_mutating_subelement,none,
"cannot use mutating member on immutable value: %0",
(StringRef))
ERROR(cannot_pass_rvalue_mutating,none,
"cannot use mutating member on immutable value of type %0",
(Type))
ERROR(cannot_pass_rvalue_mutating_getter_subelement,none,
"cannot use mutating getter on immutable value: %0",
(StringRef))
ERROR(cannot_pass_rvalue_mutating_getter,none,
"cannot use mutating getter on immutable value of type %0",
(Type))
ERROR(expression_too_complex,none,
"expression was too complex to be solved in reasonable time; "
"consider breaking up the expression into distinct sub-expressions", ())
ERROR(value_type_comparison_with_nil_illegal_did_you_mean,none,
"value of type %0 cannot be compared by reference; "
"did you mean to compare by value?",
(Type))
ERROR(value_type_comparison_with_nil_illegal,none,
"type %0 is not optional, value can never be nil",
(Type))
ERROR(cannot_match_expr_pattern_with_value,none,
"expression pattern of type %0 cannot match values of type %1",
(Type, Type))
ERROR(cannot_reference_compare_types,none,
"cannot check reference equality of functions; operands here have types "
"%1 and %2",
(StringRef, Type, Type))
ERROR(cannot_apply_binop_to_args,none,
"binary operator '%0' cannot be applied to operands of type "
"%1 and %2",
(StringRef, Type, Type))
ERROR(cannot_apply_binop_to_same_args,none,
"binary operator '%0' cannot be applied to two %1 operands",
(StringRef, Type))
ERROR(cannot_apply_unop_to_arg,none,
"unary operator '%0' cannot be applied to an operand of type %1",
(StringRef, Type))
ERROR(cannot_apply_lvalue_unop_to_subelement,none,
"cannot pass immutable value to mutating operator: %0",
(StringRef))
ERROR(cannot_apply_lvalue_unop_to_rvalue,none,
"cannot pass immutable value of type %0 to mutating operator",
(Type))
ERROR(cannot_apply_lvalue_binop_to_subelement,none,
"left side of mutating operator isn't mutable: %0", (StringRef))
ERROR(cannot_apply_lvalue_binop_to_rvalue,none,
"left side of mutating operator has immutable type %0", (Type))
ERROR(cannot_subscript_with_index,none,
"cannot subscript a value of type %0 with an index of type %1",
(Type, Type))
ERROR(cannot_subscript_base,none,
"cannot subscript a value of type %0",
(Type))
ERROR(cannot_subscript_nil_literal,none,
"cannot subscript a nil literal value", ())
ERROR(cannot_pass_rvalue_inout_subelement,none,
"cannot pass immutable value as inout argument: %0",
(StringRef))
ERROR(cannot_pass_rvalue_inout,none,
"cannot pass immutable value of type %0 as inout argument",
(Type))
ERROR(cannot_assign_to_literal,none,
"cannot assign to a literal value", ())
ERROR(cannot_call_with_no_params,none,
"cannot invoke %select{|initializer for type }1'%0' with no arguments",
(StringRef, bool))
ERROR(cannot_call_with_params, none,
"cannot invoke %select{|initializer for type }2'%0' with an argument list"
" of type '%1'", (StringRef, StringRef, bool))
NOTE(pointer_init_to_type,none,
"Pointer conversion restricted: use '.assumingMemoryBound(to:)' or '.bindMemory(to:capacity:)' to view memory as a type.", ())
ERROR(expected_do_in_statement,none,
"expected 'do' keyword to designate a block of statements", ())
ERROR(cannot_call_non_function_value,none,
"cannot call value of non-function type %0", (Type))
ERROR(wrong_argument_labels_overload,none,
"argument labels '%0' do not match any available overloads", (StringRef))
ERROR(no_candidates_match_result_type,none,
"no '%0' candidates produce the expected contextual result type %1",
(StringRef, Type))
ERROR(candidates_no_match_result_type,none,
"'%0' produces %1, not the expected contextual result type %2",
(StringRef, Type, Type))
ERROR(invalid_callee_result_type,none,
"cannot convert call result type %0 to expected type %1",
(Type, Type))
ERROR(cannot_invoke_closure,none,
"cannot invoke closure expression with an argument list of type '%0'",
(StringRef))
ERROR(cannot_invoke_closure_type,none,
"cannot invoke closure of type %0 with an argument list of type '%1'",
(Type, StringRef))
ERROR(cannot_infer_closure_type,none,
"unable to infer closure type in the current context", ())
ERROR(cannot_infer_closure_result_type,none,
"unable to infer complex closure return type; "
"add explicit type to disambiguate", ())
ERROR(incorrect_explicit_closure_result,none,
"declared closure result %0 is incompatible with contextual type %1",
(Type, Type))
ERROR(cannot_call_function_value,none,
"cannot invoke value of function type with argument list '%0'",
(StringRef))
ERROR(cannot_call_value_of_function_type,none,
"cannot invoke value of type %0 with argument list '%1'",
(Type, StringRef))
NOTE(suggest_expected_match,none,
"%select{expected an argument list|produces result}0 of type '%1'",
(bool, StringRef))
NOTE(suggest_partial_overloads,none,
"overloads for '%1' exist with these %select{"
"partially matching parameter lists|result types}0: %2",
(bool, StringRef, StringRef))
NOTE(no_binary_op_overload_for_enum_with_payload,none,
"binary operator '%0' cannot be synthesized for enums "
"with associated values",
(StringRef))
ERROR(cannot_convert_initializer_value,none,
"cannot convert value of type %0 to specified type %1", (Type,Type))
ERROR(cannot_convert_initializer_value_protocol,none,
"value of type %0 does not conform to specified type %1", (Type,Type))
ERROR(cannot_convert_initializer_value_nil,none,
"nil cannot initialize specified type %0", (Type))
ERROR(cannot_convert_to_return_type,none,
"cannot convert return expression of type %0 to return type %1",
(Type,Type))
ERROR(cannot_convert_to_return_type_protocol,none,
"return expression of type %0 does not conform to %1", (Type,Type))
ERROR(cannot_convert_to_return_type_nil,none,
"nil is incompatible with return type %0", (Type))
ERROR(cannot_convert_thrown_type,none,
"thrown expression type %0 does not conform to 'Error'", (Type))
ERROR(cannot_throw_error_code,none,
"thrown error code type %0 does not conform to 'Error'; construct an %1 "
"instance", (Type, Type))
ERROR(cannot_throw_nil,none,
"cannot infer concrete Error for thrown 'nil' value", ())
ERROR(cannot_convert_raw_initializer_value,none,
"cannot convert value of type %0 to raw type %1", (Type,Type))
ERROR(cannot_convert_raw_initializer_value_nil,none,
"cannot convert nil to raw type %0", (Type))
ERROR(cannot_convert_default_arg_value,none,
"default argument value of type %0 cannot be converted to type %1",
(Type,Type))
ERROR(cannot_convert_default_arg_value_protocol,none,
"default argument value of type %0 does not conform to %1", (Type,Type))
ERROR(cannot_convert_default_arg_value_nil,none,
"nil default argument value of cannot be converted to type %0", (Type))
ERROR(cannot_convert_argument_value,none,
"cannot convert value of type %0 to expected argument type %1",
(Type,Type))
ERROR(cannot_convert_argument_value_protocol,none,
"argument type %0 does not conform to expected type %1", (Type, Type))
ERROR(cannot_convert_partial_argument_value_protocol,none,
"in argument type %0, %1 does not conform to expected type %2", (Type, Type, Type))
ERROR(cannot_convert_argument_value_nil,none,
"nil is not compatible with expected argument type %0", (Type))
ERROR(cannot_convert_closure_result,none,
"cannot convert value of type %0 to closure result type %1",
(Type,Type))
ERROR(cannot_convert_closure_result_protocol,none,
"result value of type %0 does not conform to closure result type %1",
(Type, Type))
ERROR(cannot_convert_closure_result_nil,none,
"nil is not compatible with closure result type %0", (Type))
// Array Element
ERROR(cannot_convert_array_element,none,
"cannot convert value of type %0 to expected element type %1",
(Type,Type))
ERROR(cannot_convert_array_element_protocol,none,
"value of type %0 does not conform to expected element type %1",
(Type, Type))
ERROR(cannot_convert_array_element_nil,none,
"nil is not compatible with expected element type %0", (Type))
// Dictionary Key
ERROR(cannot_convert_dict_key,none,
"cannot convert value of type %0 to expected dictionary key type %1",
(Type,Type))
ERROR(cannot_convert_dict_key_protocol,none,
"value of type %0 does not conform to expected dictionary key type %1",
(Type, Type))
ERROR(cannot_convert_dict_key_nil,none,
"nil is not compatible with expected dictionary key type %0", (Type))
// Dictionary Value
ERROR(cannot_convert_dict_value,none,
"cannot convert value of type %0 to expected dictionary value type %1",
(Type,Type))
ERROR(cannot_convert_dict_value_protocol,none,
"value of type %0 does not conform to expected dictionary value type %1",
(Type, Type))
ERROR(cannot_convert_dict_value_nil,none,
"nil is not compatible with expected dictionary value type %0", (Type))
// Coerce Expr
ERROR(cannot_convert_coerce,none,
"cannot convert value of type %0 to type %1 in coercion",
(Type,Type))
ERROR(cannot_convert_coerce_protocol,none,
"value of type %0 does not conform to %1 in coercion",
(Type, Type))
ERROR(cannot_convert_coerce_nil,none,
"nil is not compatible with type %0 in coercion", (Type))
// Assign Expr
ERROR(cannot_convert_assign,none,
"cannot assign value of type %0 to type %1",
(Type,Type))
ERROR(cannot_convert_assign_protocol,none,
"value of type %0 does not conform to %1 in assignment",
(Type, Type))
ERROR(cannot_convert_assign_nil,none,
"nil cannot be assigned to type %0", (Type))
ERROR(throws_functiontype_mismatch,none,
"invalid conversion from throwing function of type %0 to "
"non-throwing function type %1", (Type, Type))
ERROR(noescape_functiontype_mismatch,none,
"invalid conversion from non-escaping function of type %0 to "
"potentially escaping function type %1", (Type, Type))
// Key-path expressions.
ERROR(expr_keypath_no_objc_runtime,none,
"'#keyPath' can only be used with the Objective-C runtime", ())
ERROR(expression_unused_keypath_result,none,
"result of '#keyPath' is unused", ())
ERROR(expr_keypath_non_objc_property,none,
"argument of '#keyPath' refers to non-'@objc' property %0",
(DeclName))
ERROR(stdlib_anyobject_not_found,none,
"broken standard library: cannot find 'AnyObject' protocol", ())
ERROR(expr_keypath_type_of_property,none,
"cannot refer to type member %0 within instance of type %1",
(DeclName, Type))
ERROR(expr_keypath_generic_type,none,
"'#keyPath' cannot refer to generic type %0", (DeclName))
ERROR(expr_keypath_not_property,none,
"'#keyPath' cannot refer to %0 %1", (DescriptiveDeclKind, DeclName))
ERROR(expr_keypath_empty,none,
"empty '#keyPath' does not refer to a property", ())
// Selector expressions.
ERROR(expr_selector_no_objc_runtime,none,
"'#selector' can only be used with the Objective-C runtime", ())
ERROR(expr_selector_module_missing,none,
"import the 'ObjectiveC' module to use '#selector'", ())
ERROR(expr_selector_no_declaration,none,
"argument of '#selector' does not refer to an '@objc' method, property, "
"or initializer", ())
ERROR(expr_selector_not_method,none,
"argument of '#selector' cannot refer to %select{local|global}0 "
"function %1", (bool, DeclName))
ERROR(expr_selector_expected_property,none,
"cannot reference %1 %2 as a property; remove '%select{getter|setter}0:'",
(bool, DescriptiveDeclKind, DeclName))
ERROR(expr_selector_not_property,none,
"argument of '#selector' cannot refer to %select{variable|parameter}0 %1",
(bool, DeclName))
ERROR(expr_selector_expected_method,none,
"use 'getter:'%select{| or 'setter:'}0 to refer to the Objective-C getter"
"%select{| or setter}0 of property %1%select{|, respectively}0",
(bool, DeclName))
NOTE(expr_selector_add_modifier,none,
"add '%select{getter|setter}0:' to reference the Objective-C "
"%select{getter|setter}0 for %1", (bool, DeclName))
ERROR(expr_selector_property_not_settable,none,
"argument of '#selector(setter:)' refers to non-settable %0 %1",
(DescriptiveDeclKind, DeclName))
ERROR(expr_selector_property_setter_inaccessible,none,
"setter of %0 %1 is inaccessible", (DescriptiveDeclKind, DeclName))
ERROR(expr_selector_not_objc,none,
"argument of '#selector' refers to %0 %1 that is not exposed to "
"Objective-C",
(DescriptiveDeclKind, DeclName))
NOTE(make_decl_objc,none,
"add '@objc' to expose this %0 to Objective-C",
(DescriptiveDeclKind))
// Selectors-as-string-literals.
WARNING(selector_literal_invalid,none,
"string literal is not a valid Objective-C selector", ())
WARNING(selector_literal_undeclared,none,
"no method declared with Objective-C selector %0", (ObjCSelector))
WARNING(selector_literal_deprecated,none,
"use of string literal for Objective-C selectors is deprecated; "
"use '#selector' or explicitly construct a 'Selector'", ())
WARNING(selector_literal_deprecated_suggest,none,
"use of string literal for Objective-C selectors is deprecated; "
"use '#selector' instead", ())
WARNING(selector_construction_suggest,none,
"use '#selector' instead of explicitly constructing a 'Selector'", ())
NOTE(selector_construction_suppress_warning,none,
"wrap the selector name in parentheses to suppress this warning", ())
ERROR(cannot_return_value_from_void_func,none,
"unexpected non-void return value in void function", ())
//------------------------------------------------------------------------------
// Name Binding
//------------------------------------------------------------------------------
ERROR(sema_no_import,Fatal,
"no such module '%0'", (StringRef))
ERROR(sema_no_import_repl,none,
"no such module '%0'", (StringRef))
NOTE(sema_no_import_no_sdk,none,
"did you forget to set an SDK using -sdk or SDKROOT?", ())
NOTE(sema_no_import_no_sdk_xcrun,none,
"use \"xcrun swiftc\" to select the default macOS SDK "
"installed with Xcode", ())
WARNING(sema_import_current_module,none,
"this file is part of module %0; ignoring import", (Identifier))
WARNING(sema_import_current_module_with_file,none,
"file '%0' is part of module %1; ignoring import",
(StringRef, Identifier))
ERROR(sema_opening_import,Fatal,
"opening import file for module %0: %1", (Identifier, StringRef))
ERROR(serialization_load_failed,Fatal,
"failed to load module %0", (Identifier))
ERROR(serialization_malformed_module,Fatal,
"malformed module file: %0", (StringRef))
ERROR(serialization_module_too_new,Fatal,
"module file was created by a newer version of the compiler: %0",
(StringRef))
ERROR(serialization_module_language_version_mismatch,Fatal,
"module compiled with Swift %0 cannot be imported in Swift %1: %2",
(StringRef, StringRef, StringRef))
ERROR(serialization_module_too_old,Fatal,
"module file was created by an older version of the compiler; "
"rebuild %0 and try again: %1",
(Identifier, StringRef))
ERROR(serialization_missing_single_dependency,Fatal,
"missing required module '%0'", (StringRef))
ERROR(serialization_missing_dependencies,Fatal,
"missing required modules: %0", (StringRef))
ERROR(serialization_missing_shadowed_module,Fatal,
"cannot load underlying module for %0", (Identifier))
ERROR(serialization_name_mismatch,Fatal,
"cannot load module '%0' as %1", (StringRef, Identifier))
ERROR(serialization_name_mismatch_repl,none,
"cannot load module '%0' as %1", (StringRef, Identifier))
ERROR(serialization_target_incompatible,Fatal,
"module file was created for incompatible target %0: %1",
(StringRef, StringRef))
ERROR(serialization_target_incompatible_repl,none,
"module file was created for incompatible target %0: %1",
(StringRef, StringRef))
ERROR(serialization_target_too_new,Fatal,
"module file's minimum deployment target is %0 v%1.%2%select{|.%3}3: %4",
(StringRef, unsigned, unsigned, unsigned, StringRef))
ERROR(serialization_target_too_new_repl,none,
"module file's minimum deployment target is %0 v%1.%2%select{|.%3}3: %4",
(StringRef, unsigned, unsigned, unsigned, StringRef))
ERROR(reserved_member_name,none,
"type member may not be named %0, since it would conflict with the"
" 'foo.%1' expression", (DeclName, StringRef))
ERROR(invalid_redecl,none,"invalid redeclaration of %0", (DeclName))
NOTE(invalid_redecl_prev,none,
"%0 previously declared here", (DeclName))
ERROR(ambiguous_type_base,none,
"%0 is ambiguous for type lookup in this context", (Identifier))
ERROR(invalid_member_type,none,
"%0 is not a member type of %1", (Identifier, Type))
ERROR(invalid_member_type_suggest,none,
"%0 does not have a member type named %1; did you mean %2?",
(Type, Identifier, Identifier))
ERROR(invalid_member_type_alias,none,
"typealias %0 is too complex to be used as a generic constraint; "
"use an associatedtype instead", (Identifier))
ERROR(ambiguous_member_type,none,
"ambiguous type name %0 in %1", (Identifier, Type))
ERROR(no_module_type,none,
"no type named %0 in module %1", (Identifier, Identifier))
ERROR(ambiguous_module_type,none,
"ambiguous type name %0 in module %1", (Identifier, Identifier))
ERROR(use_nonmatching_operator,none,
"%0 is not a %select{binary|prefix unary|postfix unary}1 operator",
(Identifier, unsigned))
ERROR(unspaced_binary_operator_fixit,none,
"missing whitespace between %0 and %1 operators",
(Identifier, Identifier, bool))
ERROR(unspaced_binary_operator,none,
"ambiguous missing whitespace between unary and binary operators", ())
NOTE(unspaced_binary_operators_candidate,none,
"could be %select{binary|postfix}2 %0 and %select{prefix|binary}2 %1",
(Identifier, Identifier, bool))
ERROR(unspaced_unary_operator,none,
"unary operators may not be juxtaposed; parenthesize inner expression",
())
ERROR(use_unresolved_identifier,none,
"use of unresolved %select{identifier|operator}1 %0", (DeclName, bool))
ERROR(use_undeclared_type,none,
"use of undeclared type %0", (Identifier))
ERROR(use_undeclared_type_did_you_mean,none,
"use of undeclared type %0; did you mean to use '%1'?", (Identifier, StringRef))
NOTE(note_typo_candidate,none,
"did you mean '%0'?", (StringRef))
NOTE(note_typo_candidate_implicit_member,none,
"did you mean the implicitly-synthesized %1 '%0'?", (StringRef, StringRef))
NOTE(note_remapped_type,none,
"did you mean to use '%0'?", (StringRef))
ERROR(identifier_init_failure,none,
"could not infer type for %0", (Identifier))
ERROR(pattern_used_in_type,none,
"%0 used within its own type", (Identifier))
NOTE(note_module_as_type,none,
"cannot use module %0 as a type", (Identifier))
ERROR(use_unknown_object_literal_protocol,none,
"cannot deduce protocol for %0 literal", (StringRef))
ERROR(object_literal_default_type_missing,none,
"could not infer type of %0 literal", (StringRef))
NOTE(object_literal_resolve_import,none,
"import %0 to use '%1' as the default %2 literal type",
(StringRef, StringRef, StringRef))
ERROR(use_local_before_declaration,none,
"use of local variable %0 before its declaration", (DeclName))
ERROR(unsupported_existential_type,none,
"protocol %0 can only be used as a generic constraint because it has "
"Self or associated type requirements", (Identifier))
ERROR(decl_does_not_exist_in_module,none,
"%select{**MODULE**|type|struct|class|enum|protocol|variable|function}0 "
"%1 does not exist in module %2",
(/*ImportKind*/ unsigned, Identifier, Identifier))
ERROR(imported_decl_is_wrong_kind,none,
"%0 was imported as '%1', but is a "
"%select{**MODULE**|type|struct|class|enum|protocol|variable|function}2",
(Identifier, StringRef, /*ImportKind*/ unsigned))
ERROR(ambiguous_decl_in_module,none,
"ambiguous name %0 in module %1", (Identifier, Identifier))
ERROR(module_not_testable,none,
"module %0 was not compiled for testing", (Identifier))
// Operator decls
ERROR(ambiguous_operator_decls,none,
"ambiguous operator declarations found for operator", ())
NOTE(found_this_operator_decl,none,
"found this matching operator declaration", ())
ERROR(operator_redeclared,none,
"operator redeclared", ())
NOTE(previous_operator_decl,none,
"previous operator declaration here", ())
ERROR(declared_operator_without_operator_decl,none,
"operator implementation without matching operator declaration", ())
ERROR(declared_unary_op_without_attribute,none,
"unary operator implementation must have a 'prefix' or 'postfix' modifier", ())
ERROR(unary_op_missing_prepos_attribute,none,
"%select{prefix|postfix}0 unary operator missing "
"'%select{prefix|postfix}0' modifier", (bool))
NOTE(unary_operator_declaration_here,none,
"%select{prefix|postfix}0 operator found here", (bool))
ERROR(invalid_arg_count_for_operator,none,
"operators must have one or two arguments", ())
ERROR(operator_in_local_scope,none,
"operator functions can only be declared at global or in type scope", ())
ERROR(nonstatic_operator_in_type,none,
"operator %0 declared in type %1 must be 'static'", (Identifier, Type))
ERROR(nonfinal_operator_in_class,none,
"operator %0 declared in non-final class %1 must be 'final'",
(Identifier, Type))
ERROR(operator_in_unrelated_type,none,
"member operator %2%select{| of protocol %0}1 must have at least one "
"argument of type %select{%0|'Self'}1", (Type, bool, DeclName))
// Precedence groups
ERROR(ambiguous_precedence_groups,none,
"multiple precedence groups found", ())
NOTE(found_this_precedence_group,none,
"found this matching precedence group", ())
ERROR(unknown_precedence_group,none,
"unknown precedence group %0", (Identifier))
ERROR(precedence_group_cycle,none,
"cycle in higherThan relation: %0", (StringRef))
ERROR(precedence_group_lower_within_module,none,
"precedence group cannot be given lower precedence than group in same"
" module; make the other precedence group higher than this one instead",
())
NOTE(precedence_group_declared_here,none,"precedence group declared here",
())
ERROR(precedence_group_redeclared,none,
"precedence group redeclared", ())
NOTE(previous_precedence_group_decl,none,
"previous precedence group declaration here", ())
//------------------------------------------------------------------------------
// Type Check Coercions
//------------------------------------------------------------------------------
ERROR(tuple_conversion_not_expressible,none,
"cannot express tuple conversion %0 to %1", (Type, Type))
ERROR(load_of_explicit_lvalue,none,
"%0 variable is not being passed by reference", (Type))
//------------------------------------------------------------------------------
// Expression Type Checking Errors
//------------------------------------------------------------------------------
ERROR(types_not_convertible,none,
"%1 is not %select{convertible to|a subtype of}0 %2",
(bool, Type, Type))
NOTE(in_cast_expr_types,none,
"in cast from type %0 to %1",
(Type, Type))
ERROR(types_not_convertible_use_bool_value,none,
"%0 is not convertible to %1; did you mean %0.boolValue", (Type, Type))
ERROR(tuple_types_not_convertible_nelts,none,
"%0 is not convertible to %1, "
"tuples have a different number of elements", (Type, Type))
ERROR(tuple_types_not_convertible,none,
"tuple type %0 is not convertible to tuple %1", (Type, Type))
ERROR(invalid_force_unwrap,none,
"cannot force unwrap value of non-optional type %0", (Type))
ERROR(invalid_optional_chain,none,
"cannot use optional chaining on non-optional value of type %0",
(Type))
ERROR(if_expr_cases_mismatch,none,
"result values in '? :' expression have mismatching types %0 and %1",
(Type, Type))
ERROR(did_not_call_function_value,none,
"function value was used as a property; add () to call it",
())
ERROR(did_not_call_function,none,
"function %0 was used as a property; add () to call it",
(Identifier))
ERROR(did_not_call_method,none,
"method %0 was used as a property; add () to call it",
(Identifier))
ERROR(init_not_instance_member,none,
"'init' is a member of the type; use 'type(of: ...)' to initialize "
"a new object of the same dynamic type", ())
ERROR(super_initializer_not_in_initializer,none,
"'super.init' cannot be called outside of an initializer", ())
WARNING(isa_is_always_true,none, "'%0' test is always true",
(StringRef))
WARNING(isa_is_foreign_check,none,
"'is' test is always true because %0 is a Core Foundation type",
(Type))
WARNING(conditional_downcast_coercion,none,
"conditional cast from %0 to %1 always succeeds",
(Type, Type))
WARNING(forced_downcast_noop,none,
"forced cast of %0 to same type has no effect", (Type))
WARNING(forced_downcast_coercion,none,
"forced cast from %0 to %1 always succeeds; did you mean to use 'as'?",
(Type, Type))
ERROR(downcast_same_type,none,
"downcast from %0 to %1 only unwraps optionals; did you mean to use "
"'%2'?",
(Type, Type, StringRef))
WARNING(downcast_to_unrelated,none,
"cast from %0 to unrelated type %1 always fails", (Type, Type))
ERROR(downcast_to_more_optional,none,
"cannot downcast from %0 to a more optional type %1",
(Type, Type))
ERROR(optional_chain_noop,none,
"optional chain has no effect, expression already produces %0",
(Type))
ERROR(optional_chain_isnt_chaining,none,
"'?' must be followed by a call, member lookup, or subscript",
())
ERROR(pattern_in_expr,none,
"%0 cannot appear in an expression", (PatternKind))
NOTE(note_call_to_operator,none,
"in call to operator %0", (Identifier))
NOTE(note_call_to_func,none,
"in call to function %0", (Identifier))
NOTE(note_call_to_initializer,none,
"in call to initializer", ())
NOTE(note_init_parameter,none,
"in initialization of parameter %0", (Identifier))
ERROR(missing_nullary_call,none,
"function produces expected type %0; did you mean to call it with '()'?",
(Type))
ERROR(missing_unwrap_optional,none,
"value of optional type %0 not unwrapped; did you mean to use '!' "
"or '?'?",
(Type))
ERROR(missing_unwrap_optional_try,none,
"value of optional type %0 not unwrapped; did you mean to use 'try!' "
"or chain with '?'?",
(Type))
ERROR(missing_forced_downcast,none,
"%0 is not convertible to %1; "
"did you mean to use 'as!' to force downcast?", (Type, Type))
ERROR(missing_explicit_conversion,none,
"%0 is not implicitly convertible to %1; "
"did you mean to use 'as' to explicitly convert?", (Type, Type))
ERROR(missing_address_of,none,
"passing value of type %0 to an inout parameter requires explicit '&'",
(Type))
ERROR(extra_address_of,none,
"'&' used with non-inout argument of type %0",
(Type))
ERROR(extra_address_of_unsafepointer,none,
"'&' is not allowed passing array value as %0 argument",
(Type))
ERROR(missing_init_on_metatype_initialization,none,
"initializing from a metatype value must reference 'init' explicitly",
())
ERROR(extra_argument_labels,none,
"extraneous argument label%select{|s}0 '%1' in %select{call|subscript}2",
(bool, StringRef, bool))
ERROR(missing_argument_labels,none,
"missing argument label%select{|s}0 '%1' in %select{call|subscript}2",
(bool, StringRef, bool))
ERROR(wrong_argument_labels,none,
"incorrect argument label%select{|s}0 in %select{call|subscript}3 "
"(have '%1', expected '%2')",
(bool, StringRef, StringRef, bool))
ERROR(extra_named_single_element_tuple,none,
"cannot treat single-element named tuple as a scalar; use '.%0' to "
"access its element", (StringRef))
ERROR(argument_out_of_order_named_named,none,
"argument %0 must precede argument %1", (Identifier, Identifier))
ERROR(argument_out_of_order_named_unnamed,none,
"argument %0 must precede unnamed argument #%1", (Identifier, unsigned))
ERROR(argument_out_of_order_unnamed_named,none,
"unnamed argument #%0 must precede argument %1", (unsigned, Identifier))
ERROR(argument_out_of_order_unnamed_unnamed,none,
"unnamed argument #%0 must precede unnamed argument #%1",
(unsigned, unsigned))
ERROR(instance_member_use_on_type,none,
"use of instance member %1 on type %0; "
"did you mean to use a value of type %0 instead?", (Type, DeclName))
ERROR(instance_member_in_initializer,none,
"cannot use instance member %0 within property initializer; "
"property initializers run before 'self' is available", (DeclName))
ERROR(instance_member_in_default_parameter,none,
"cannot use instance member %0 as a default parameter", (DeclName))
ERROR(invalid_initialization_parameter_same_type,none,
"invalid initializer call with same type %0 as parameter", (Type))
ERROR(missing_argument_named,none,
"missing argument for parameter %0 in call", (Identifier))
ERROR(missing_argument_positional,none,
"missing argument for parameter #%0 in call", (unsigned))
ERROR(extra_argument_named,none,
"extra argument %0 in call", (Identifier))
ERROR(extra_argument_positional,none,
"extra argument in call", ())
ERROR(extra_argument_to_nullary_call,none,
"argument passed to call that takes no arguments", ())
ERROR(extra_trailing_closure_in_call,none,
"extra trailing closure passed in call", ())
ERROR(no_accessible_initializers,none,
"%0 cannot be constructed because it has no accessible initializers",
(Type))
ERROR(unbound_generic_parameter,none,
"generic parameter %0 could not be inferred", (Type))
ERROR(unbound_generic_parameter_cast,none,
"generic parameter %0 could not be inferred in cast to %1", (Type, Type))
NOTE(archetype_declared_in_type,none,
"%0 declared as parameter to type %1", (Type, Type))
NOTE(unbound_generic_parameter_explicit_fix,none,
"explicitly specify the generic arguments to fix this issue", ())
ERROR(string_index_not_integer,none,
"String may not be indexed with %0, it has variable size elements",
(Type))
NOTE(string_index_not_integer_note,none,
"consider using an existing high level algorithm, "
"str.startIndex.advanced(by: n), or a projection like str.utf8", ())
ERROR(invalid_c_function_pointer_conversion_expr,none,
"a C function pointer can only be formed from a reference to a 'func' or "
"a literal closure", ())
ERROR(c_function_pointer_from_method,none,
"a C function pointer cannot be formed from a method", ())
ERROR(c_function_pointer_from_generic_function,none,
"a C function pointer cannot be formed from a reference to a generic "
"function", ())
ERROR(c_function_pointer_from_function_with_context,none,
"a C function pointer cannot be formed from a "
"%select{local function|closure}0 that captures "
"%select{context|generic parameters|dynamic Self type}1",
(bool, unsigned))
NOTE(c_function_pointer_captures_here,none,
"%0 captured here", (Identifier))
//------------------------------------------------------------------------------
// Type Check Declarations
//------------------------------------------------------------------------------
ERROR(var_type_not_materializable,none,
"type %0 of variable is not materializable", (Type))
ERROR(param_type_non_materializable_tuple,none,
"named parameter has type %0 which includes nested inout parameters",
(Type))
ERROR(enum_element_not_materializable,none,
"type of enum case is not materializable", ())
ERROR(missing_initializer_def,PointsToFirstBadToken,
"initializer requires a body", ())
// Attributes
ERROR(attr_decl_attr_now_on_type,none,
"%0 is now an attribute on a parameter type, "
"instead of on the parameter itself", (StringRef))
ERROR(operator_not_func,none,
"operators must be declared with 'func'", ())
ERROR(redefining_builtin_operator,none,
"cannot declare a custom %0 '%1' operator", (StringRef, StringRef))
ERROR(attribute_requires_operator_identifier,none,
"'%0' requires a function with an operator identifier", (StringRef))
ERROR(attribute_requires_single_argument,none,
"'%0' requires a function with one argument", (StringRef))
ERROR(var_parameter_not_allowed,none,
"parameters may not have the 'var' specifier", ())
ERROR(mutating_invalid_global_scope,none,
"'mutating' is only valid on methods", ())
ERROR(mutating_invalid_classes,none,
"'mutating' isn't valid on methods in classes or class-bound protocols",
())
ERROR(functions_mutating_and_not,none,
"method may not be declared both mutating and nonmutating", ())
ERROR(static_functions_not_mutating,none,
"static functions may not be declared mutating", ())
ERROR(transparent_stored_property,none,
"@_transparent cannot be applied to stored properties", ())
ERROR(transparent_on_invalid_extension,none,
"@_transparent is only supported on struct and enum extensions", ())
ERROR(transparent_in_protocols_not_supported,none,
"@_transparent is not supported on declarations within protocols", ())
ERROR(transparent_in_classes_not_supported,none,
"@_transparent is not supported on declarations within classes", ())
ERROR(invalid_iboutlet,none,
"only instance properties can be declared @IBOutlet", ())
ERROR(iboutlet_nonobjc_class,none,
"@IBOutlet property cannot %select{have|be an array of}0 "
"non-'@objc' class type %1", (bool, Type))
ERROR(iboutlet_nonobjc_protocol,none,
"@IBOutlet property cannot %select{have|be an array of}0 "
"non-'@objc' protocol type %1", (bool, Type))
ERROR(iboutlet_nonobject_type,none,
"@IBOutlet property cannot %select{have|be an array of}0 "
"non-object type %1", (bool, Type))
ERROR(iboutlet_only_mutable,none,
"@IBOutlet attribute requires property to be mutable", ())
ERROR(iboutlet_non_optional,none,
"@IBOutlet property has non-optional type %0", (Type))
NOTE(note_make_optional,none,
"add '?' to form the optional type %0", (Type))
NOTE(note_make_implicitly_unwrapped_optional,none,
"add '!' to form the implicitly unwrapped optional type %0", (Type))
ERROR(invalid_ibdesignable_extension,none,
"@IBDesignable can only be applied to classes and extensions "
"of classes", ())
ERROR(invalid_ibinspectable,none,
"only instance properties can be declared @%0", (StringRef))
ERROR(invalid_ibaction_decl,none,
"only instance methods can be declared @IBAction", ())
ERROR(invalid_ibaction_result,none,
"methods declared @IBAction must return 'Void' (not %0)", (Type))
ERROR(invalid_ibaction_argument_count,none,
"@IBAction methods %select{must have a single argument"
"|can only have up to 2 arguments}0", (bool))
ERROR(ibaction_nonobjc_class_argument,none,
"argument to @IBAction method cannot have non-'@objc' class type %0",
(Type))
ERROR(ibaction_nonobject_argument,none,
"argument to @IBAction method cannot have non-object type %0", (Type))
ERROR(no_objc_tagged_pointer_not_class_protocol,none,
"@unsafe_no_objc_tagged_pointer can only be applied to class protocols",
())
ERROR(swift_native_objc_runtime_base_not_on_root_class,none,
"@_swift_native_objc_runtime_base_not_on_root_class can only be applied "
"to root classes", ())
ERROR(cdecl_not_at_top_level,none,
"@_cdecl can only be applied to global functions", ())
ERROR(cdecl_empty_name,none,
"@_cdecl symbol name cannot be empty", ())
ERROR(cdecl_throws,none,
"raising errors from @_cdecl functions is not supported", ())
ERROR(attr_methods_only,none,
"only methods can be declared %0", (DeclAttribute))
ERROR(access_control_in_protocol,none,
"%0 modifier cannot be used in protocols", (DeclAttribute))
ERROR(access_control_setter,none,
"'%select{private|fileprivate|internal|public}0(set)' modifier can only "
"be applied to variables and subscripts",
(Accessibility))
ERROR(access_control_setter_read_only,none,
"'%select{private|fileprivate|internal|public}0(set)' modifier cannot be "
"applied to %select{constants|read-only variables|read-only properties"
"|read-only subscripts}1",
(Accessibility, unsigned))
ERROR(access_control_setter_more,none,
"%select{private|fileprivate|internal|PUBLIC}0 "
"%select{variable|property|subscript}1 cannot have "