@@ -125,7 +125,8 @@ instance NFData ShowDiagnostic where
125
125
126
126
-- | A Maybe-like wrapper for a GhcMessage that doesn't try to compare, show, or
127
127
-- force the GhcMessage inside, so that we can derive Show, Eq, Ord, NFData on
128
- -- FileDiagnostic
128
+ -- FileDiagnostic. FileDiagnostic only uses this as metadata so we can safely
129
+ -- ignore it in fields.
129
130
data StructuredMessage
130
131
= NoStructuredMessage
131
132
| SomeStructuredMessage (MsgEnvelope GhcMessage )
@@ -156,10 +157,17 @@ instance NFData StructuredMessage where
156
157
-- along with the related source location so that we can display the error
157
158
-- on either the console or in the IDE at the right source location.
158
159
--
160
+ -- It also optionally keeps a structured diagnostic message GhcMessage in
161
+ -- StructuredMessage.
162
+ --
159
163
data FileDiagnostic = FileDiagnostic
160
164
{ fdFilePath :: NormalizedFilePath
161
165
, fdShouldShowDiagnostic :: ShowDiagnostic
162
166
, fdLspDiagnostic :: Diagnostic
167
+ -- | The optional GhcMessage inside of this StructuredMessage is ignored for
168
+ -- Eq, Ord, Show, and NFData instances. This is fine because this field
169
+ -- should only ever be metadata and should never be used to distinguish
170
+ -- between FileDiagnostics.
163
171
, fdStructuredMessage :: StructuredMessage
164
172
}
165
173
deriving (Eq , Ord , Show , Generic )
0 commit comments