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.
This commit is contained in:
Etienne Millon 2023-04-21 11:37:55 +02:00 committed by Etienne Millon
parent 0e9f0c6893
commit a922be057f
2 changed files with 7 additions and 1 deletions

View File

@ -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)

View File

@ -349,7 +349,10 @@ let check_phrase phrase =
let env = !Toploop.toplevel_env in
(* Construct "let _ () = let module _ = struct <items> 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