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

Wrong type is inferred for Foo.t #185

Closed
nyuichi opened this issue Jul 9, 2019 · 0 comments · Fixed by #208
Closed

Wrong type is inferred for Foo.t #185

nyuichi opened this issue Jul 9, 2019 · 0 comments · Fixed by #208
Labels

Comments

@nyuichi
Copy link
Contributor

nyuichi commented Jul 9, 2019

(cf. #184)

It is a common style to use t to name a type that is of importance in a module in OCaml/Reason/etc.
However, when I try to do so in satysfi and combine it with inductive types, satysfi report a strange type error.
Namely, for the following code,

module Hoge : sig
  type 'a t
end = struct
  type 'a t = Hoge
end

module Fuga : sig
  type 'a t
  val get : 'a t -> 'a Hoge.t
end = struct
  type 'a t = C of 'a Hoge.t

  let-rec get (C r) = r    % r should be of 'a Hoge.t but has 'a Fuga.t
end

I got an error saying

! [Type Error] at "crash2.satyh", line 7, character 0 to line 14, character 3:
    The implementation of value 'get' has type
      '#a Fuga.t -> '#a Fuga.t
    which is inconsistent with the type required by the signature
      '#a Fuga.t -> '#a Hoge.t

I think the type checker has a bug on handling type names.
When I changed the name of Fuga.t to Fuga.t1, the bug disappeared.

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

Successfully merging a pull request may close this issue.

2 participants