-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Using the 4.12 branch (currently fead9e4), dns-server.4.6.2 fails to build with the following error message:
#=== ERROR while compiling dns-server.4.6.2 ===================================#
# context 2.1.0~beta3 | linux/x86_64 | ocaml-variants.4.12.0+trunk | file:///home/opam/opam-repository
# path ~/.opam/4.12.0+trunk/.opam-switch/build/dns-server.4.6.2
# command ~/.opam/4.12.0+trunk/bin/dune build -p dns-server -j 47
# exit-code 1
# env-file ~/.opam/log/dns-server-7-994c42.env
# output-file ~/.opam/log/dns-server-7-994c42.out
### output ###
# ocamlopt server/.dns_server.objs/native/dns_trie.{cmx,o} (exit 2)
# (cd _build/default && /home/opam/.opam/4.12.0+trunk/bin/ocamlopt.opt -w -40 -g -I server/.dns_server.objs/byte -I server/.dns_server.objs/native -I /home/opam/.opam/4.12.0+trunk/lib/astring -I /home/opam/.opam/4.12.0+trunk/lib/bigarray-compat -I /home/opam/.opam/4.12.0+trunk/lib/cstruct -I /home/opam/.opam/4.12.0+trunk/lib/dns -I /home/opam/.opam/4.12.0+trunk/lib/domain-name -I /home/opam/.opam/4.12.0+trunk/lib/duration -I /home/opam/.opam/4.12.0+trunk/lib/fmt -I /home/opam/.opam/4.12.0+trunk/lib/gmap -I /home/opam/.opam/4.12.0+trunk/lib/ipaddr -I /home/opam/.opam/4.12.0+trunk/lib/logs -I /home/opam/.opam/4.12.0+trunk/lib/macaddr -I /home/opam/.opam/4.12.0+trunk/lib/metrics -I /home/opam/.opam/4.12.0+trunk/lib/ptime -I /home/opam/.opam/4.12.0+trunk/lib/randomconv -I /home/opam/.opam/4.12.0+trunk/lib/result -I /home/opam/.opam/4.12.0+trunk/lib/rresult -I /home/opam/.opam/4.12.0+trunk/lib/seq -I /home/opam/.opam/4.12.0+trunk/lib/stdlib-shims -intf-suffix .ml -no-alias-deps -o server/.dns_server.objs/native/dns_trie.cmx -c -impl server/dns_trie.ml)
# File "server/dns_trie.ml", line 270, characters 33-34:
# 270 | Error (`Empty (name, K Ns))
# ^
# Error: Unbound constructor K
This package compiled fine with OCaml 4.11.
The K constructor is defined in Dns.Rr_map as type k = K : 'a key -> k, the Dns module is opened at the top in Dns_trie and the constructor is found through constructor disambiguation (added in OCaml 4.01)
Here is the code: https://github.com/mirage/ocaml-dns/blob/713138069df05b1b2176c24fc0e6a792d4f59f3b/server/dns_trie.ml#L270
I've tried to reproduce the failure in the toplevel without success for the past hour, I have no idea what is making this bit of code behave differently but in a nutshell, here is what the code looks like simplified:
module M = struct
module Sub = struct
type k = K : int -> k
end
end
open M
let f = function
| 1 -> `Error (Sub.K 1)
| _ -> `Error (K 1)
I've tried adding more ifs and higher-order functions like the original code does but I couldn't find a simple enough test-case that would fail. I don't really know where to look for that but I'm sure there are people here who would know how to get a compelling failing test-case quicker than I could.
EDIT: compelling test-case, failing on 4.12 but not in < 4.11 bellow