Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006388OCamlOCaml generalpublic2014-05-01 20:152014-06-03 14:37
Reporterwhitequark 
Assigned Tofrisch 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version4.02.0+dev 
Summary0006388: Error messages for 1-tuples are confusing
DescriptionIf 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.
TagsNo tags attached.
Attached Files

- Relationships
related to 0006424resolvedfrisch 0-ary function application miscompiles and segfaults ocamlrun 

-  Notes
(0011339)
frisch (developer)
2014-05-02 14:58

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.
(0011637)
frisch (developer)
2014-06-03 14:36

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.

- Issue History
Date Modified Username Field Change
2014-05-01 20:15 whitequark New Issue
2014-05-02 14:58 frisch Note Added: 0011339
2014-05-30 12:37 shinwell Relationship added related to 0006424
2014-05-30 12:38 shinwell Status new => acknowledged
2014-06-03 14:36 frisch Note Added: 0011637
2014-06-03 14:37 frisch Status acknowledged => resolved
2014-06-03 14:37 frisch Fixed in Version => 4.02.0+dev
2014-06-03 14:37 frisch Resolution open => fixed
2014-06-03 14:37 frisch Assigned To => frisch


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker