Skip to content

Commit de6870e

Browse files
Merge pull request #82478 from swiftlang/jepa3
AST: Fix out of sync diagnostic
2 parents f941590 + 797548a commit de6870e

File tree

2 files changed

+23
-18
lines changed

2 files changed

+23
-18
lines changed

include/swift/AST/DeclContext.h

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -114,21 +114,20 @@ enum class DeclContextKind : unsigned {
114114
/// Describes the kind of a particular conformance.
115115
///
116116
/// The following code involves conformances of the three different kinds:
117-
/// \code
118-
/// protocol P { }
119-
/// protocol P2 : P { }
120117
///
121-
/// class Super : P2 { }
122-
/// class Sub : Super { }
123-
/// \endcode
118+
/// protocol P { }
119+
/// protocol P2 : P { }
124120
///
125-
/// \c Super conforms to \c P2 via an explicit conformance,
121+
/// class Super : P2 { }
122+
/// class Sub : Super { }
123+
///
124+
/// `Super` conforms to `P2` via an explicit conformance,
126125
/// specified on the class declaration itself.
127126
///
128-
/// \c Super conforms to \c P via an implied conformance, whose
129-
/// origin is the explicit conformance to \c P2.
127+
/// `Super` conforms to `P` via an implied conformance, whose
128+
/// origin is the explicit conformance to `P2`.
130129
///
131-
/// \c Sub conforms to \c P2 and \c P via inherited conformances,
130+
/// `Sub` conforms to `P2` and `P` via inherited conformances,
132131
/// which link back to the conformances described above.
133132
///
134133
/// The enumerators are ordered in terms of decreasing preference:
@@ -137,22 +136,28 @@ enum class DeclContextKind : unsigned {
137136
/// conformance kinds supersede later conformance kinds, possibly with a
138137
/// diagnostic (e.g., if an inherited conformance supersedes an
139138
/// explicit conformance).
139+
///
140+
/// - Important: The raw values of these cases are relied upon by
141+
/// `declared_protocol_conformance_here`.
142+
/// - If you add a new case, give it an explicit raw value.
143+
/// - If you change the cases, make sure they remain in sync with the
144+
/// aforementioned diagnostic.
140145
enum class ConformanceEntryKind : unsigned {
141146
/// Inherited from a superclass conformance.
142-
Inherited,
147+
Inherited = 0,
143148

144149
/// Explicitly specified.
145-
Explicit,
150+
Explicit = 1,
146151

147152
/// The conformance is generated by a macro that has not been
148153
/// expanded yet.
149-
PreMacroExpansion,
154+
PreMacroExpansion = 2,
150155

151156
/// Implicitly synthesized.
152-
Synthesized,
157+
Synthesized = 3,
153158

154159
/// Implied by an explicitly-specified conformance.
155-
Implied,
160+
Implied = 4,
156161

157162
Last_Kind = Implied
158163
};

include/swift/AST/DiagnosticsSema.def

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3274,9 +3274,9 @@ NOTE(protocol_conformance_here,none,
32743274
NOTE(declared_protocol_conformance_here,none,
32753275
"%select{%0 inherits conformance to protocol %2 from superclass|"
32763276
"%0 declares conformance to protocol %2|"
3277-
"%0 implicitly conforms to protocol %2 (via conformance to %3)|"
3278-
"%0 implicitly conforms to protocol %2 |"
3279-
"conformance to %2 generated by macro }1 here",
3277+
"conformance to %2 generated by macro|"
3278+
"%0 implicitly conforms to protocol %2|"
3279+
"%0 implicitly conforms to protocol %2 (via conformance to %3)}1 here",
32803280
(Type, unsigned, Identifier, Identifier))
32813281

32823282
ERROR(witness_unavailable,none,

0 commit comments

Comments
 (0)