| Anonymous | Login | Signup for a new account | 2013-05-24 17:42 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||||
| 0005267 | OCaml | Camlp4 | public | 2011-05-17 07:49 | 2012-09-20 16:19 | ||||||
| Reporter | Dmitry Grebeniuk | ||||||||||
| Assigned To | |||||||||||
| Priority | normal | Severity | minor | Reproducibility | always | ||||||
| Status | acknowledged | Resolution | open | ||||||||
| Platform | OS | OS Version | |||||||||
| Product Version | 3.13.0+dev | ||||||||||
| Target Version | 4.01.0+dev | Fixed in Version | |||||||||
| Summary | 0005267: camlp4r (?) does not respect the constructor's arity | ||||||||||
| Description | # type t1 = [ A of int ]; type t1 = [ A of int ] # fun [ A "a" True -> () ]; Characters 6-16: fun [ A "a" True -> () ]; ^^^^^^^^^^ Error: This pattern matches values of type (string * bool) but a pattern was expected which matches values of type int The error here should be more like to "Error: The constructor A expects 1 argument(s), but is applied here to 2 argument(s)" Maybe this is a minor issue itself, but it leads to very hard to find errors when the wrong type infers from pattern matching and spreads all over the code: # type t 'a = [ T of 'a ]; type t 'a = [ T of 'a ] # value f x = match x with [ T a b -> a ]; value f : t ('a * 'b) -> 'a = <fun> | ||||||||||
| Tags | No tags attached. | ||||||||||
| Attached Files | |||||||||||
Notes |
|
|
(0007687) doligez (manager) 2012-07-10 15:09 |
This is not really a camlp4 problem, because the compiler does automatic tuplification of constructor arguments when you pass several arguments to a unary constructor: $ ocaml Objective Caml version 3.12.1 # type t1 = A of int;; type t1 = A of int # function A ("a", true) -> ();; Error: This pattern matches values of type string * bool but a pattern was expected which matches values of type int # |
|
(0008128) doligez (manager) 2012-09-20 16:19 |
Definitely not a camlp4 problem. We could have a better error message for the first example, but there's nothing we can do to prevent propagation in the second example. |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2011-05-17 07:49 | Dmitry Grebeniuk | New Issue | |
| 2011-05-17 07:49 | Dmitry Grebeniuk | Status | new => assigned |
| 2011-05-17 07:49 | Dmitry Grebeniuk | Assigned To | => ertai |
| 2011-10-26 08:35 | ertai | Assigned To | ertai => xclerc |
| 2012-07-10 15:09 | doligez | Note Added: 0007687 | |
| 2012-07-10 15:09 | doligez | Target Version | => 4.01.0+dev |
| 2012-07-31 13:36 | doligez | Target Version | 4.01.0+dev => 4.00.1+dev |
| 2012-09-20 16:19 | doligez | Note Added: 0008128 | |
| 2012-09-20 16:19 | doligez | Assigned To | xclerc => |
| 2012-09-20 16:19 | doligez | Status | assigned => acknowledged |
| 2012-09-20 16:19 | doligez | Target Version | 4.00.1+dev => 4.01.0+dev |
| Copyright © 2000 - 2011 MantisBT Group |