OlivierNicole / ocaml

The core OCaml system: compilers, runtime system, base libraries

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix quoting of local variant constructors

OlivierNicole opened this issue · comments

Quoting local constructors is not protected at all, unlike local variables:

# module M = struct
 type t = Foo | Bar of int
 macro y = << let x = Foo in match x with Bar z -> z >
end;;
Warning 8: this pattern-matching is not exhaustive.
Here is an example of a case that is not matched:
Foo
module M : sig type t = Foo | Bar of int macro y : int expr end
# M.y;;;
- : int expr = << let x_1 = Foo  in match x_1 with | Bar z_2 -> z_2 >>
# $M.y;;
Error: Unbound constructor Foo

Only constructors from external units should be quoted until this is fixed.