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

Freezing on cyclic type abbreviations #467

Open
mikeshulman opened this issue Nov 11, 2023 · 2 comments
Open

Freezing on cyclic type abbreviations #467

mikeshulman opened this issue Nov 11, 2023 · 2 comments

Comments

@mikeshulman
Copy link

In utop 2.13.1 for ocaml 5.1.0, entering

type t = t;;

causes the program to freeze and become unresponsive, instead of giving the correct error message "The type abbreviation t is cyclic" (which the ordinary toplevel does). This appears to be a regression since 2.12.1 for ocaml 5.0.0.

(It's possible this problem is not confined to utop, as I have also experienced a similar issue with Merlin, but only in a more complicated situation that I haven't managed to minimize yet.)

@huwaireb
Copy link
Contributor

huwaireb commented Nov 15, 2023

I've encountered the same issue only on OCaml 5.1.0 (didn't encounter on OCaml 5.0.0).

This also applies to

(* Cycle_in_def *)
type a = b
and b = a

as well, which is supposed to report a "The definition of %s contains a cycle", but instead results in a stack overflow shortly after freezing.

What I found odd however, is the following works just fine:

(* Recursive_abbrev *)
type ('a, 'b) t = ('b, 'a) t 

resulting in:

Error: The type abbreviation t is cyclic:
('a, 'b) t = ('b, 'a) t

but

(* Recursive_abbrev *)
type ('a, 'b) t = ('a, 'b) t

causes a stack overflow.

Screenshot 2023-11-15 at 3 27 24 PM

Seems to work fine in the ocaml repl as well
Screenshot 2023-11-15 at 3 32 15 PM

@huwaireb
Copy link
Contributor

huwaireb commented Nov 15, 2023

Occurs with dune as well, but seems to work on 5.2.0.

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

No branches or pull requests

2 participants