From a922be057f6b17a5ad75bbe64ec96482a14ff2f9 Mon Sep 17 00:00:00 2001 From: Etienne Millon Date: Fri, 21 Apr 2023 11:37:55 +0200 Subject: [PATCH] fix regression with unit qualification Fixes #428 The change in #418 introduced a regression if a `Unit` module in scope does not have a `()` constructor in it. This switches to the more explicit `Stdlib.Unit.()` path. --- CHANGES.md | 3 +++ src/lib/uTop.ml | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index cef6f13..e9d5196 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,9 @@ unreleased ---------- +* Fix regression with unit qualification when a `Unit` module is in scope with + no `()` constructor (#429, fixes #428, @emillon) + * emacs: add completion-at-point implementation (#406, fixes #261, @j-shilling) 2.12.0 (2023-04-17) diff --git a/src/lib/uTop.ml b/src/lib/uTop.ml index 9062d49..b222ffc 100644 --- a/src/lib/uTop.ml +++ b/src/lib/uTop.ml @@ -349,7 +349,10 @@ let check_phrase phrase = let env = !Toploop.toplevel_env in (* Construct "let _ () = let module _ = struct end in ()" in order to test the typing and compilation of [items] without evaluating them. *) - let unit = with_loc loc (Longident.Ldot (Lident "Unit", "()")) in + let unit = + let (%.) a b = Longident.Ldot (a, b) in + with_loc loc (Lident "Stdlib" %. "Unit" %. "()") + in let top_def = let open Ast_helper in with_default_loc loc