Fix PR#6056

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13845 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Jacques Garrigue 2013-06-28 10:43:25 +00:00
parent d6d2c4b3ea
commit 07b8b7dd74
3 changed files with 17 additions and 1 deletions

View File

@ -157,7 +157,7 @@ Bug fixes:
- PR#6031: Camomile problem with -with-frame-pointers
- PR#6032: better Random.self_init under Windows
- PR#6033: Matching.inline_lazy_force needs eta-expansion (command-line flags)
- PR#6056: Using 'match' prevents generalization of values
Internals:
- Moved debugger/envaux.ml to typing/envaux.ml to publish env_of_only_summary
as part of compilerlibs, to be used on bin-annot files.

View File

@ -654,3 +654,16 @@ let (A x) = (raise Exit : s);;
(* PR#5224 *)
type 'x t = < f : 'y. 'y t >;;
(* PR#6056, PR#6057 *)
let using_match b =
let f =
match b with
| true -> fun x -> x
| false -> fun x -> x
in
f 0,f
;;
match (fun x -> x), fun x -> x with x, y -> x, y;;
match fun x -> x with x -> x, x;;

View File

@ -1288,6 +1288,9 @@ let rec is_nonexpansive exp =
| Texp_function _ -> true
| Texp_apply(e, (_,None,_)::el) ->
is_nonexpansive e && List.for_all is_nonexpansive_opt (List.map snd3 el)
| Texp_match(e, pat_exp_list, _) ->
is_nonexpansive e &&
List.for_all (fun (pat, exp) -> is_nonexpansive exp) pat_exp_list
| Texp_tuple el ->
List.for_all is_nonexpansive el
| Texp_construct( _, _, el,_) ->