diff options
| author | Gaëtan Gilbert | 2020-03-09 14:39:35 +0100 |
|---|---|---|
| committer | Gaëtan Gilbert | 2020-03-09 14:39:35 +0100 |
| commit | b02ae8e4faa26ded157c9379572e9a43e0394290 (patch) | |
| tree | a73dc48faf096d830b38918e0f1176759611f06f | |
| parent | dbd3a4c4213b3d56908a8387de93e27aaec501a4 (diff) | |
Fix #11730: Mangle Names vs Infix
| -rw-r--r-- | test-suite/bugs/closed/bug_11730.v | 6 | ||||
| -rw-r--r-- | vernac/metasyntax.ml | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/test-suite/bugs/closed/bug_11730.v b/test-suite/bugs/closed/bug_11730.v new file mode 100644 index 0000000000..f788636f9c --- /dev/null +++ b/test-suite/bugs/closed/bug_11730.v @@ -0,0 +1,6 @@ +Set Mangle Names. + +Infix "&&&" := andb (at level 40, left associativity). +(* Error: Variable _0 occurs more than once. *) + +Check (_ &&& _). diff --git a/vernac/metasyntax.ml b/vernac/metasyntax.ml index 33fd14a731..10946d78f0 100644 --- a/vernac/metasyntax.ml +++ b/vernac/metasyntax.ml @@ -1708,7 +1708,7 @@ let add_infix ~local deprecation env ({CAst.loc;v=inf},modifiers) pr sc = (* check the precedence *) let vars = names_of_constr_expr pr in let x = Namegen.next_ident_away (Id.of_string "x") vars in - let y = Namegen.next_ident_away (Id.of_string "y") vars in + let y = Namegen.next_ident_away (Id.of_string "y") (Id.Set.add x vars) in let metas = [inject_var x; inject_var y] in let c = mkAppC (pr,metas) in let df = CAst.make ?loc @@ Id.to_string x ^" "^(quote_notation_token inf)^" "^Id.to_string y in |
