File tree Expand file tree Collapse file tree 1 file changed +6
-16
lines changed
Expand file tree Collapse file tree 1 file changed +6
-16
lines changed Original file line number Diff line number Diff line change @@ -365,28 +365,18 @@ impl Backend {
365365 let mut checker = mq_check:: TypeChecker :: with_options ( self . config . type_checker_options ) ;
366366 let type_errors = checker. check ( & hir_guard) ;
367367
368- // Build a set of (line, column) start positions from the current source's symbols
369- // so that type errors originating from other sources (e.g., pre-loaded modules)
370- // are not incorrectly attributed to this file.
371- let source_locations: FxHashSet < ( u32 , usize ) > = hir_guard
372- . symbols_for_source ( source_id)
373- . filter_map ( |( _, symbol) | {
374- symbol
375- . source
376- . text_range
377- . as_ref ( )
378- . map ( |r| ( r. start . line , r. start . column ) )
379- } )
380- . collect ( ) ;
381-
368+ // Filter type errors so that only those originating from the current source
369+ // (as identified by `source_id`) are attributed to this file. This avoids
370+ // accidentally attaching errors from other sources that may share the same
371+ // (line, column) coordinates.
382372 self . type_env_map
383373 . insert ( uri_string. clone ( ) , checker. symbol_types ( ) . clone ( ) ) ;
384374 errors. extend (
385375 type_errors
386376 . into_iter ( )
387377 . filter ( |e| {
388- e. location ( )
389- . map ( |( line , col ) | source_locations . contains ( & ( line , col ) ) )
378+ e. source_id ( )
379+ . map ( |id| id == source_id )
390380 . unwrap_or ( false )
391381 } )
392382 . map ( LspError :: TypeError ) ,
You can’t perform that action at this time.
0 commit comments