You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Diagnostics.md
+11-2Lines changed: 11 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,8 @@ Clang also has a kind of diagnostic called a "remark", which represents informat
41
41
- Normal: "cannot call 'super.init' outside of an initializer"
42
42
- Better: "'super.init' cannot be called outside of an initializer"
43
43
44
-
- When referring to attributes by name, use *either* "the 'foo' attribute" or "'@foo'", rather than "the '@foo' attribute".
44
+
- When referring to attributes by name, use *either*`attribute 'foo'` or
45
+
`'@foo'`, rather than `attribute '@foo'`.
45
46
46
47
- Match the tone and phrasing of other diagnostics. Some common phrases:
47
48
@@ -130,7 +131,10 @@ If you run into any issues or have questions while following the steps above, fe
130
131
131
132
-`%%` - Emits a literal percent sign.
132
133
133
-
There are several format specifiers that are specific to `Decl` parameters:
134
+
The following subsections describe format specifiers that are specific to
135
+
diagnostic arguments of a given type.
136
+
137
+
#### `Decl`
134
138
135
139
-`%kind0` - Prefixes the declaration's name with its descriptive decl kind (e.g. `instance method 'foo(x:)'`).
136
140
@@ -140,6 +144,11 @@ There are several format specifiers that are specific to `Decl` parameters:
140
144
141
145
-`%kindbase0` - Combines `kind` and `base` (e.g. `instance method 'foo'`).
142
146
147
+
#### `TypeAttribute`
148
+
149
+
-`%kind0` - Replaced with `attribute 'foo'`, whereas `%0` is replaced with
150
+
`'@foo'`.
151
+
143
152
Note: If your diagnostic could apply to accessors, be careful how you format the declaration's name; accessors have an empty name, so you need to display their accessor kind and the name of their storage decl instead. Inserting the name with a `Decl *` parameter will handle these complications automatically; if you want to use `DeclName` or `Identifier` instead, you'll probably need a separate version of the diagnostic for accessors.
0 commit comments