Fix #6193 (Incorrect warning 12 for character ranges).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14205 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
2d5bd02021
commit
5554eb13e9
|
@ -968,14 +968,16 @@ let rec type_pat ~constrs ~labels ~no_existentials ~mode ~env sp expected_ty =
|
|||
pat_env = !env }
|
||||
| Ppat_interval (Const_char c1, Const_char c2) ->
|
||||
let open Ast_helper.Pat in
|
||||
let gloc = {loc with Location.loc_ghost=true} in
|
||||
let rec loop c1 c2 =
|
||||
if c1 = c2 then constant ~loc (Const_char c1)
|
||||
if c1 = c2 then constant ~loc:gloc (Const_char c1)
|
||||
else
|
||||
or_ ~loc
|
||||
(constant ~loc (Const_char c1))
|
||||
or_ ~loc:gloc
|
||||
(constant ~loc:gloc (Const_char c1))
|
||||
(loop (Char.chr(Char.code c1 + 1)) c2)
|
||||
in
|
||||
let p = if c1 <= c2 then loop c1 c2 else loop c2 c1 in
|
||||
let p = {p with ppat_loc=loc} in
|
||||
type_pat p expected_ty (* TODO: record 'extra' to remember about interval *)
|
||||
| Ppat_interval _ ->
|
||||
raise (Error (loc, !env, Invalid_interval))
|
||||
|
|
Loading…
Reference in New Issue