Browse Source

[display] don't lose display position in type path handler

Simon Krajewski 6 years ago
parent
commit
315b36fad7
1 changed files with 3 additions and 2 deletions
  1. 3 2
      src/compiler/displayOutput.ml

+ 3 - 2
src/compiler/displayOutput.ml

@@ -483,7 +483,8 @@ module TypePathHandler = struct
 			(* This is a bit wacky: We want to reset the display position so that revisiting the display file
 			(* This is a bit wacky: We want to reset the display position so that revisiting the display file
 			   does not raise another TypePath exception. However, we still want to have it treated like the
 			   does not raise another TypePath exception. However, we still want to have it treated like the
 			   display file, so we just set the position to 0 (#6558). *)
 			   display file, so we just set the position to 0 (#6558). *)
-			DisplayPosition.display_position#set {DisplayPosition.display_position#get with pmin = 0; pmax = 0};
+			let old = DisplayPosition.display_position#get in
+			DisplayPosition.display_position#set {old with pmin = 0; pmax = 0};
 			let rec lookup p =
 			let rec lookup p =
 				try
 				try
 					TypeloadModule.load_module ctx (p,s_module) null_pos
 					TypeloadModule.load_module ctx (p,s_module) null_pos
@@ -495,7 +496,7 @@ module TypePathHandler = struct
 					else
 					else
 						raise e
 						raise e
 			in
 			in
-			let m = lookup sl_pack in
+			let m = Std.finally (fun () -> DisplayPosition.display_position#set old) lookup sl_pack in
 			let statics = ref None in
 			let statics = ref None in
 			let enum_statics = ref None in
 			let enum_statics = ref None in
 			let public_types = List.filter (fun t ->
 			let public_types = List.filter (fun t ->