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

[> {typexpr} as 't ] yields a syntax error with yacc syntax #3957

Closed
vicuna opened this issue Jan 20, 2006 · 3 comments
Closed

[> {typexpr} as 't ] yields a syntax error with yacc syntax #3957

vicuna opened this issue Jan 20, 2006 · 3 comments

Comments

@vicuna
Copy link

vicuna commented Jan 20, 2006

Original bug ID: 3957
Reporter: alexbaretta
Status: acknowledged (set by @damiendoligez on 2006-03-29T14:34:19Z)
Resolution: open
Priority: normal
Severity: minor
Category: documentation
Related to: #3835

Bug description

root@alex:~# ledit ocaml
Objective Caml version 3.09.1+dev5 (2005-12-05)

type 'a foo = [ `Foo of 'a ];;

type 'a foo = [ `Foo of 'a ]

let x : [> 'x foo as 'x] option = None;;

Syntax error

#load "camlp4o.cma";;

    Camlp4 Parsing version 3.09.1+dev5 (2005-12-05)

let x : [> 'x foo as 'x] option = None;;

val x : [> ('a foo as 'a) foo ] option = None

Additional information

The problem is hardly significant, as the camlp4 based parsers easily allow to overcome it.

@vicuna
Copy link
Author

vicuna commented Jan 23, 2006

Comment author: @mauny

Seems that camlp4 conforms to the spec. Similar to issue #3835.

@vicuna
Copy link
Author

vicuna commented Jul 2, 2013

Comment author: @damiendoligez

Looking at the 4.01 version of the documentation, it is indeed slightly incomplete because it is not "typexpr" that is allowed here, but a restricted subset. The solution is general: add parentheses to make the parser happy:

let x : [> ('x foo as 'x) ] option = None;;

val x : [> ('a foo as 'a) foo ] option = None

Note: there are other constructs with the same kind of problem. In the future, we may make the documentation more precise, but I don't see this as a high-priority task.

@github-actions
Copy link

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

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

1 participant