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

Polymorphic type annotations generalize weak polymorphic variables #9856

Closed
thierry-martinez opened this issue Aug 24, 2020 · 2 comments
Closed
Labels
Milestone

Comments

@thierry-martinez
Copy link
Contributor

@thierry-martinez thierry-martinez commented Aug 24, 2020

Polymorphic type annotations generalize weak polymorphic variables, making such programs type check and segfault:

let f x =
  let ref : type a . a option ref = ref None in
  ref := Some x;
  Option.get !ref

let () = print_string (f 0)

This program is rejected by OCaml 4.10 but is accepted by OCaml 4.11 and trunk. Bisection points to the commit c272447.

@gasche
Copy link
Member

@gasche gasche commented Aug 25, 2020

Woops! Looks like an opportunity for a 4.11.1.

@lpw25
Copy link
Contributor

@lpw25 lpw25 commented Aug 25, 2020

Fixed by #9857

@gasche gasche added this to the 4.11 milestone Aug 25, 2020
@gasche gasche added the bug label Aug 25, 2020
lpw25 added a commit to lpw25/ocaml that referenced this issue Aug 26, 2020
Octachron added a commit that referenced this issue Aug 27, 2020
Add missing `lower_contravariant` call (fixes #9856)
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

3 participants