You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 5892 Reporter:@lpw25 Assigned to:@garrigue Status: closed (set by @xavierleroy on 2015-12-11T18:18:42Z) Resolution: fixed Priority: normal Severity: minor Version: 4.00.1 Fixed in version: 4.00.2+dev Category: typing Related to:#5853 Child of:#5998 Monitored by:@gasche@diml
Bug description
I haven't explored the issue fully, but there is something wrong with the GADT exhaustivness check. The problem is probably in Ctype.mcomp.
The following files will give a segmentation fault when run:
testList.ml:
module type Num = sig
type nil
type _ cons
end
module Make (N: Num) = struct
type nil = N.nil
type 'a cons = 'a N.cons
type ('a,'b) t =
| Cons : 'a * ('a, 'b) t -> ('a, 'b N.cons) t
| Nil : ('a, N.nil) t
end
module Bad = struct
type nil
type _ cons = nil
end
module Types = Make(Bad)
let bad: (int, Types.nil Types.cons) Types.t = Types.Nil
testList.mli:
module Types : sig
type _ cons
type nil
type ('a,_) t =
| Cons : 'a * ('a, 'b) t -> ('a, 'b cons) t
| Nil : ('a, nil) t
end
val bad: (int, Types.nil Types.cons) Types.t
test.ml:
let hd: type a b . (a, b TestList.Types.cons) TestList.Types.t -> a =
fun (TestList.Types.Cons(x,_)) -> x
Fixed in 4.00 and trunk, revisions 13250 and 13252.
Ctype.in_pervasives was broken: looking for a path TestList.nil in the empty environment also looks it up inside testList.cmi...
Now we also require that the path has no prefix (subsumed by Ctype.in_current_module).
As a result, Pervasives.in_channel and Pervasives.out_channel are no longer recognized as incompatible types (only those in predef.ml are incompatible).
Original bug ID: 5892
Reporter: @lpw25
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2015-12-11T18:18:42Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.00.1
Fixed in version: 4.00.2+dev
Category: typing
Related to: #5853
Child of: #5998
Monitored by: @gasche @diml
Bug description
I haven't explored the issue fully, but there is something wrong with the GADT exhaustivness check. The problem is probably in Ctype.mcomp.
The following files will give a segmentation fault when run:
testList.ml:
module type Num = sig
type nil
type _ cons
end
module Make (N: Num) = struct
type nil = N.nil
type 'a cons = 'a N.cons
end
module Bad = struct
type nil
type _ cons = nil
end
module Types = Make(Bad)
let bad: (int, Types.nil Types.cons) Types.t = Types.Nil
testList.mli:
module Types : sig
end
val bad: (int, Types.nil Types.cons) Types.t
test.ml:
let hd: type a b . (a, b TestList.Types.cons) TestList.Types.t -> a =
fun (TestList.Types.Cons(x,_)) -> x
let _ = hd TestList.bad
Steps to reproduce
$ ocamlc -c testList.mli
$ ocamlc -c testList.ml
$ ocamlc -c test.ml
$ ./a.out
Segmentation fault
The text was updated successfully, but these errors were encountered: