@@ -14,7 +14,7 @@ pub use position::PositionRange;
1414mod severity;
1515pub use severity:: Severity ;
1616
17- mod single_quote ;
17+ mod single_quoted ;
1818
1919mod path_colon;
2020use path_colon:: path_colon;
@@ -43,6 +43,10 @@ use module_import_cycle_diagnostic::module_import_cycle_diagnostic;
4343mod no_location_info_diagnostic;
4444use no_location_info_diagnostic:: no_location_info_diagnostic;
4545
46+ mod not_found;
47+ use not_found:: not_found;
48+ pub use not_found:: NotFound ;
49+
4650use super :: rest_of_line;
4751use super :: CompilingModule ;
4852
@@ -51,6 +55,13 @@ use super::CompilingModule;
5155/// These include progress updates on compilation, errors and warnings, or GHCi messages.
5256#[ derive( Debug , Clone , PartialEq , Eq ) ]
5357pub enum GhcMessage {
58+ /// A module or file was not found.
59+ ///
60+ /// ```text
61+ /// File src/Foo.hs not found
62+ /// Module Foo not found
63+ /// ```
64+ NotFound ( NotFound ) ,
5465 /// A module being compiled.
5566 ///
5667 /// ```text
@@ -167,13 +178,20 @@ fn parse_messages_inner(input: &mut &str) -> PResult<Vec<GhcMessage>> {
167178 repeat (
168179 0 ..,
169180 alt ( (
170- compiling. map ( Item :: One ) ,
171- generic_diagnostic. map ( Item :: One ) ,
172- cant_find_file_diagnostic. map ( Item :: One ) ,
173- no_location_info_diagnostic. map ( Item :: One ) ,
181+ compiling. map ( GhcMessage :: Compiling ) . map ( Item :: One ) ,
182+ generic_diagnostic
183+ . map ( GhcMessage :: Diagnostic )
184+ . map ( Item :: One ) ,
185+ compilation_summary. map ( GhcMessage :: Summary ) . map ( Item :: One ) ,
186+ not_found. map ( GhcMessage :: NotFound ) . map ( Item :: One ) ,
187+ cant_find_file_diagnostic
188+ . map ( GhcMessage :: Diagnostic )
189+ . map ( Item :: One ) ,
190+ no_location_info_diagnostic
191+ . map ( GhcMessage :: Diagnostic )
192+ . map ( Item :: One ) ,
174193 module_import_cycle_diagnostic. map ( Item :: Many ) ,
175194 loaded_configuration. map ( Item :: One ) ,
176- compilation_summary. map ( Item :: One ) ,
177195 rest_of_line. map ( |line| {
178196 tracing:: debug!( line, "Ignoring GHC output line" ) ;
179197 Item :: Ignore
@@ -213,6 +231,10 @@ mod tests {
213231 Preprocessing library 'test-dev' for my-simple-package-0.1.0.0..
214232 GHCi, version 9.0.2: https://www.haskell.org/ghc/ :? for help
215233 Loaded GHCi configuration from /Users/wiggles/.ghci
234+ File src/Puppy.hs not found
235+ File src/
236+ Puppy.hs not found
237+ Module Puppy.Doggy not found
216238 [1 of 4] Compiling MyLib ( src/MyLib.hs, interpreted )
217239 [2 of 4] Compiling MyModule ( src/MyModule.hs, interpreted )
218240
@@ -233,6 +255,9 @@ mod tests {
233255 GhcMessage :: LoadConfig {
234256 path: "/Users/wiggles/.ghci" . into( )
235257 } ,
258+ GhcMessage :: NotFound ( NotFound :: File ( "src/Puppy.hs" . into( ) ) ) ,
259+ GhcMessage :: NotFound ( NotFound :: File ( "src/\n Puppy.hs" . into( ) ) ) ,
260+ GhcMessage :: NotFound ( NotFound :: Module ( "Puppy.Doggy" . into( ) ) ) ,
236261 GhcMessage :: Compiling ( CompilingModule {
237262 name: "MyLib" . into( ) ,
238263 path: "src/MyLib.hs" . into( ) ,
0 commit comments