You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 6388 Reporter:@whitequark Assigned to:@alainfrisch Status: closed (set by @xavierleroy on 2015-12-11T18:27:53Z) Resolution: fixed Priority: normal Severity: minor Fixed in version: 4.02.0+dev Category: ~DO NOT USE (was: OCaml general) Related to:#6424
Bug description
If I construct an 1-tuple directly via AST, e.g. with Ast_helper.Exp.tuple [a], the error message from typechecker is as follows:
Error: This expression has type int but an expression was expected of type int
Also, the pretty-printer prints it as an expression, which doesn't help.
I think the Pprintast should be extended to print 1-tuples (and perhaps 0-tuples?) in a special way; if I did not know exactly what the bug were, I would have spent hours figuring it out.
The text was updated successfully, but these errors were encountered:
Instead of adapting the printer, I think it would make more sense to check in the type-checker the invariants which are normally enforced by the parser, but could be broken if one uses -pp/-ppx processors.
Commit 14949 in 4.02 checks that tuples have at least 2 elements. (Please shout if you have a legitimate use of "unary tuples" in generated code.) The same commit adds some more invariant checks.
Original bug ID: 6388
Reporter: @whitequark
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2015-12-11T18:27:53Z)
Resolution: fixed
Priority: normal
Severity: minor
Fixed in version: 4.02.0+dev
Category: ~DO NOT USE (was: OCaml general)
Related to: #6424
Bug description
If I construct an 1-tuple directly via AST, e.g. with
Ast_helper.Exp.tuple [a]
, the error message from typechecker is as follows:Error: This expression has type int but an expression was expected of type int
Also, the pretty-printer prints it as an expression, which doesn't help.
I think the Pprintast should be extended to print 1-tuples (and perhaps 0-tuples?) in a special way; if I did not know exactly what the bug were, I would have spent hours figuring it out.
The text was updated successfully, but these errors were encountered: