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

Better handling of unary tuple type #5728

Closed
vicuna opened this issue Aug 16, 2012 · 1 comment
Closed

Better handling of unary tuple type #5728

vicuna opened this issue Aug 16, 2012 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Aug 16, 2012

Original bug ID: 5728
Reporter: furuse
Status: closed (set by @mshinwell on 2016-12-07T13:41:20Z)
Resolution: won't fix
Priority: normal
Severity: feature
Version: 4.00.0
Category: ~DO NOT USE (was: OCaml general)
Related to: #5811

Bug description

Playing with compiler-libs, I found that it is now rather easy to create an unary tuple value Parsetree node and it is typable with a strange unary tuple type.

Of course it is the user's responsibility not to create such strange AST nodes, but I think the compiler can provide some help by explicitly rejecting the typing of unary tuples.

BTW, the type error message related with this unary tuple type looks very cryptic:

Error: This expression has type 'a but an expression was expected of type
string

Here 'a is not a simple Tvar but something to be printed like Tuple('a), which is not unifiable with string.

@vicuna
Copy link
Author

vicuna commented Dec 7, 2016

Comment author: @mshinwell

I think it is unfortunately the programmer's responsibility to get this sort of thing right. There has been some suggestion of trying to write a better interface to Parsetree (in particular for the purposes of increasing the maintainability of ppx code). This sort of thing could probably be cleaned up at the same time.

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