Fix PR#6768: Typechecker overflow the stack on cyclic type

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15810 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Jacques Garrigue 2015-02-05 07:47:14 +00:00
parent 0f5046b8b4
commit a5252548c6
5 changed files with 27 additions and 1 deletions

View File

@ -136,6 +136,7 @@ Bug fixes:
- PR#6727: Printf.sprintf "%F" misbehavior
(Benoît Vaugon, report by Vassili Karpov)
- PR#6763: #show with -short-paths doesn't select shortest type paths
- PR#6768: Typechecker overflow the stack on cyclic type
- ocamlbuild on cygwin cannot find ocamlfind
(user 'algoriddle')
- allow android build with pthreads support (since SDK r10c)

View File

@ -0,0 +1,11 @@
(* PR#6768 *)
type _ prod = Prod : ('a * 'y) prod;;
let f : type t. t prod -> _ = function Prod ->
let module M =
struct
type d = d * d
end
in ()
;;

View File

@ -0,0 +1,7 @@
# type _ prod = Prod : ('a * 'y) prod
# Characters 87-96:
type d = d * d
^^^^^^^^^
Error: The type abbreviation d is cyclic
#

View File

@ -0,0 +1,7 @@
# type _ prod = Prod : ('a * 'y) prod
# Characters 87-96:
type d = d * d
^^^^^^^^^
Error: The type abbreviation d is cyclic
#

View File

@ -523,7 +523,7 @@ let check_well_founded env loc path to_check ty =
(* Will be detected by check_recursion *)
Btype.backtrack snap
in
check ty TypeSet.empty ty
Ctype.wrap_trace_gadt_instances env (check ty TypeSet.empty) ty
let check_well_founded_manifest env loc path decl =
if decl.type_manifest = None then () else