Fix bug exposed by previous commit

This commit is contained in:
Jeremie Dimino 2018-05-17 15:46:09 +01:00
parent 0d27e9f909
commit 9d3117d63e
3 changed files with 8 additions and 1 deletions

View File

@ -43,6 +43,9 @@ next
- Add an `ignored_subdirs` stanza to replace `jbuild-ignore` files - Add an `ignored_subdirs` stanza to replace `jbuild-ignore` files
(#767, @diml) (#767, @diml)
- Fix a bug where Dune ignored previous occurences of duplicated
fields (#779, @diml)
1.0+beta20 (10/04/2018) 1.0+beta20 (10/04/2018)
----------------------- -----------------------

View File

@ -273,6 +273,8 @@ module Of_sexp = struct
| List (_, name_sexp :: values) -> begin | List (_, name_sexp :: values) -> begin
match name_sexp with match name_sexp with
| Atom (_, A name) -> | Atom (_, A name) ->
if Name_map.mem acc name then
of_sexp_errorf sexp "Field %S is present too many times" name;
Name_map.add acc name { values; entry = sexp } Name_map.add acc name { values; entry = sexp }
| List _ | Quoted_string _ -> | List _ | Quoted_string _ ->
of_sexp_error name_sexp "Atom expected" of_sexp_error name_sexp "Atom expected"

View File

@ -27,5 +27,7 @@ let of_sexp = record (field "foo" int)
let x = of_sexp sexp let x = of_sexp sexp
[%%expect{| [%%expect{|
val of_sexp : int Stdune.Sexp.Of_sexp.t = <fun> val of_sexp : int Stdune.Sexp.Of_sexp.t = <fun>
val x : int = 2 Exception:
Stdune__Sexp.Of_sexp.Of_sexp (<abstr>,
"Field \"foo\" is present too many times", None).
|}] |}]