From 5554eb13e93aef36861b09901a450022733eb2f9 Mon Sep 17 00:00:00 2001 From: Alain Frisch Date: Tue, 1 Oct 2013 11:40:21 +0000 Subject: [PATCH] Fix #6193 (Incorrect warning 12 for character ranges). git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14205 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- typing/typecore.ml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/typing/typecore.ml b/typing/typecore.ml index fee74fd6b..2649430e8 100644 --- a/typing/typecore.ml +++ b/typing/typecore.ml @@ -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))