Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polymorphism failure on polymorphic variants inside a record through a local and open function. #4350

Closed
vicuna opened this issue Jul 26, 2007 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented Jul 26, 2007

Original bug ID: 4350
Reporter: jm
Status: closed (set by @garrigue on 2007-10-29T04:41:45Z)
Resolution: fixed
Priority: normal
Severity: major
Version: 3.10+dev
Fixed in version: 3.10+dev
Category: ~DO NOT USE (was: OCaml general)

Bug description

$ocamlc -v
The Objective Caml compiler, version 3.10.1+dev0 (2007-05-21)
...
$cat file.ml
module Ok =
struct
type 'a t = [ A of 'a | B ]

let fuun = function `A _ -> () | _ -> ()

let ook (t: 'a t) =
fuun t

let ok (t: 'a t) =
(function A _ -> () | B -> ()) t

let ko (t: 'a t) =
(function `A _ -> () | _ -> ()) t
end

module Ko =
struct
type 'a s = [ A of 'a | B ]
type 'a t = { s : 'a s }

let fuun = function `A _ -> () | _ -> ()

let ook (t: 'a t) =
fuun t.s

let ok (t: 'a t) =
(function A _ -> () | B -> ()) t.s

let ko (t: 'a t) =
(function `A _ -> () | _ -> ()) t.s
end

$ocamlc -c -i file.ml
module Ok :
sig
type 'a t = [ A of 'a | B ]
val fuun : [> A of 'a ] -> unit val ook : 'a t -> unit val ok : 'a t -> unit val ko : 'a t -> unit end module Ko : sig type 'a s = [ A of 'a | B ] type 'a t = { s : 'a s; } val fuun : [> A of 'a ] -> unit
val ook : 'a t -> unit
val ok : 'a t -> unit
val ko : '_a t -> unit
end

To my mind, Ko.ko should have the signature: 'a t -> unit,
as it has with ocamlc 3.09.2 for instance.

@vicuna
Copy link
Author

vicuna commented Oct 29, 2007

Comment author: @garrigue

Delayed checks were changing type levels...
Fixed in branch release310 (typing/typecore.ml)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant