Skip to content

Commit

Permalink
fix regression with unit qualification
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
emillon committed Apr 21, 2023
1 parent 0e9f0c6 commit a922be0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
5 changes: 4 additions & 1 deletion src/lib/uTop.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a922be0

Please sign in to comment.