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

"Fatal error: types should not include variables" #6158

Closed
vicuna opened this issue Sep 4, 2013 · 1 comment
Closed

"Fatal error: types should not include variables" #6158

vicuna opened this issue Sep 4, 2013 · 1 comment
Assignees

Comments

@vicuna
Copy link

vicuna commented Sep 4, 2013

Original bug ID: 6158
Reporter: @yallop
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2015-12-11T18:24:06Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.01.0+beta/+rc
Fixed in version: 4.01.0+dev
Category: typing

Bug description

The following code should be rejected but triggers an internal error:

$ cat vars.ml
type 'a t = T of 'a
type 'a s = S of 'a

type (_, _) eq = Refl : ('a, 'a) eq

let f : (int s, int t) eq -> unit = function
| Refl -> ()
$ ocamlc vars.ml

Fatal error: types should not include variables
Fatal error: exception Misc.Fatal_error

A similar example with well-typed code gives the same error:

$ cat vars2.ml
type (_, _) eq = Refl : ('a, 'a) eq

module M (S : sig
type 'a t = T of 'a
type 'a s = T of 'a
end) =
struct
let f : ('a S.s, 'a S.t) eq -> unit = function
| Refl -> ()
end
$ ocamlc vars2.ml

Fatal error: types should not include variables
Fatal error: exception Misc.Fatal_error

@vicuna
Copy link
Author

vicuna commented Sep 5, 2013

Comment author: @garrigue

Fixed in trunk and 4.01, revision 14064.

Indeed, the incompatibility check is more clever than before, but as a result it may be called on type definitions containing variables. No need to fail in that case.

Keep this PR open, as there is a minor side-problem, as the non-principal typechecker may leave reified variables in exported types. They are detected and report when using -principal.
While it would be better to do that without -principal too, this has no impact on soundness.

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

No branches or pull requests

2 participants