diff --git a/src/compiler/server.ml b/src/compiler/server.ml index 1d30345acae..aa9380ef59c 100644 --- a/src/compiler/server.ml +++ b/src/compiler/server.ml @@ -343,14 +343,21 @@ let check_module sctx com m_path m_extra p = | MSGood | MSUnknown -> None | MSBad reason -> - Some reason + let is_display_file = DisplayPosition.display_position#is_in_file (Path.UniqueKey.lazy_key m_extra.m_file) in + let ignore_bad = not com.is_macro_context && not com.display.dms_full_typing && not is_display_file in + if ignore_bad then None else Some reason end else begin (* Otherwise, set to current compilation mark for recursion *) m_extra.m_checked <- start_mark; let dirty = match m_extra.m_cache_state with | MSBad reason -> (* If we are already dirty, stick to it. *) - Some reason + let is_display_file = DisplayPosition.display_position#is_in_file (Path.UniqueKey.lazy_key m_extra.m_file) in + let ignore_bad = not com.is_macro_context && not com.display.dms_full_typing && not is_display_file in + if ignore_bad then begin + m_extra.m_cache_state <- MSUnknown; + check () + end else Some reason | MSUnknown -> (* This should not happen because any MSUnknown module is supposed to have the current m_checked. *) die "" __LOC__ @@ -359,6 +366,9 @@ let check_module sctx com m_path m_extra p = m_extra.m_cache_state <- MSUnknown; check () in + let is_display_file = DisplayPosition.display_position#is_in_file (Path.UniqueKey.lazy_key m_extra.m_file) in + let ignore_bad = not com.is_macro_context && not com.display.dms_full_typing && not is_display_file in + let dirty = if ignore_bad then None else dirty in (* Update the module now. It will use this dirty status for the remainder of this compilation. *) begin match dirty with | Some reason -> @@ -448,10 +458,15 @@ class hxb_reader_api_server GoodModule (com.module_lut#find m_path) with Not_found -> try let mc = cc#get_hxb_module m_path in - begin match mc.mc_extra.m_cache_state with - | MSBad reason -> BadModule reason - | _ -> BinaryModule mc - end + let is_display_file = DisplayPosition.display_position#is_in_file (Path.UniqueKey.lazy_key mc.mc_extra.m_file) in + let ignore_bad = not com.is_macro_context && not com.display.dms_full_typing && not is_display_file in + if ignore_bad then + BinaryModule mc + else + begin match mc.mc_extra.m_cache_state with + | MSBad reason -> BadModule reason + | _ -> BinaryModule mc + end with Not_found -> NoModule @@ -550,11 +565,20 @@ and type_module sctx com delay mpath p = try let m = cc#find_module m_path in begin match m.m_extra.m_cache_state with - | MSBad reason -> BadModule reason + | MSBad reason -> + let is_display_file = DisplayPosition.display_position#is_in_file (Path.UniqueKey.lazy_key m.m_extra.m_file) in + let ignore_bad = not com.is_macro_context && not com.display.dms_full_typing && not is_display_file in + if ignore_bad then raise Not_found; + BadModule reason | _ -> GoodModule m end; with Not_found -> try let mc = cc#get_hxb_module m_path in + let is_display_file = DisplayPosition.display_position#is_in_file (Path.UniqueKey.lazy_key mc.mc_extra.m_file) in + let ignore_bad = not com.is_macro_context && not com.display.dms_full_typing && not is_display_file in + if ignore_bad then + BinaryModule mc + else begin match mc.mc_extra.m_cache_state with | MSBad reason -> BadModule reason | _ -> BinaryModule mc