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

Toplevel doesn't accept the type info it writes itself. #5155

Closed
vicuna opened this issue Sep 26, 2010 · 3 comments
Closed

Toplevel doesn't accept the type info it writes itself. #5155

vicuna opened this issue Sep 26, 2010 · 3 comments
Assignees
Milestone

Comments

@vicuna
Copy link

vicuna commented Sep 26, 2010

Original bug ID: 5155
Reporter: yziquel
Assigned to: @garrigue
Status: resolved (set by @damiendoligez on 2012-09-19T12:13:05Z)
Resolution: suspended
Priority: normal
Severity: minor
Version: 3.12.0
Target version: 4.01.0+dev
Category: ~DO NOT USE (was: OCaml general)

Bug description

Here's a type declaration that is accepted. However the type information that is returned isn't accepted by the toplevel.

yziquel@seldon:~$ ocaml
Objective Caml version 3.12.0

type 'a t = private ( < .. > as 'a);;

type 'a t = private < .. > constraint 'a = 'a t

type 'a t = private < .. > constraint 'a = 'a t;;

Error: The type constraints are not consistent.
Type 'a is not compatible with type 'a t

@vicuna
Copy link
Author

vicuna commented Oct 2, 2010

Comment author: @garrigue

I admit the situation is confusing.
However, I have no easy fix at this point.
Parsing of type expressions is so complicated that fixing this is bound to break something else...

Two remarks:

  1. I'm afraid this definition is not what you intended. It defines a private row type, whose parameter is constrained to be itself. This is not a private abbreviation, and actually this type ends up not being usable.
  2. If you want a private abbreviation, the declaration should be
    type 'a t = 'a constraint 'a = < .. >
    This version gets printed correctly.

@vicuna
Copy link
Author

vicuna commented Oct 3, 2010

Comment author: yziquel

Thanks. I believe that

type 'a t = 'a constraint 'a = < .. >

is indeed what I want. Couldn't it be possible to make the toplevel print this type declaration instead of the following?

type 'a t = < .. > constraint 'a t = 'a

It seems to me that the main issue is the fact that 'a is implicit in < .. >. Wouldn't it be better to have a way to make it explicit? Like < .. as 'a >?

@vicuna
Copy link
Author

vicuna commented Sep 19, 2012

Comment author: @damiendoligez

This type definition is not accepted anymore in 4.00.0, so the problem disappeared.

@vicuna vicuna closed this as completed Sep 19, 2012
@vicuna vicuna added this to the 4.01.0 milestone Mar 14, 2019
@vicuna vicuna added the bug label Mar 20, 2019
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