| Anonymous | Login | Signup for a new account | 2013-06-19 16:19 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 | |||||||
| 0005502 | OCaml | OCaml general | public | 2012-02-09 00:23 | 2012-02-09 07:37 | |||||||
| Reporter | john_nowak | |||||||||||
| Assigned To | gasche | |||||||||||
| Priority | normal | Severity | minor | Reproducibility | always | |||||||
| Status | resolved | Resolution | no change required | |||||||||
| Platform | OS | OS Version | ||||||||||
| Product Version | 3.12.1 | |||||||||||
| Target Version | Fixed in Version | |||||||||||
| Summary | 0005502: Pattern matching allows wildcards to be used with nullary constructors | |||||||||||
| Description | The following should most likely be rejected but are accepted by the compiler: fun (None _) -> 42 match None with None _ -> 42 ... This bug appears to only be present with wildcards; all other pattern arguments to nullary constructors result in the appropriate error. | |||||||||||
| Tags | No tags attached. | |||||||||||
| Attached Files | ||||||||||||
Notes |
|
|
(0006902) john_nowak (reporter) 2012-02-09 00:25 |
I should note that this is actually a minor portability issue. Older OCaml compilers (e.g. 3.10.2) will reject such code. |
|
(0006903) gasche (developer) 2012-02-09 07:34 edited on: 2012-02-09 07:37 |
This is not a bug but a dubious feature. This behavior is intentional: `Foo _` will ignore the constructor at any arity (including zero). This is so you don't have to write eg. `Foo (_, _, _, _)` if the arity is four, which would be rather painful. PS: but you can ask to be warned in the case where this construct is used on a constant constructor (arity zero): it's warning 28, introduced in 3.12.0. |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2012-02-09 00:23 | john_nowak | New Issue | |
| 2012-02-09 00:25 | john_nowak | Note Added: 0006902 | |
| 2012-02-09 07:34 | gasche | Note Added: 0006903 | |
| 2012-02-09 07:37 | gasche | Note Edited: 0006903 | View Revisions |
| 2012-02-09 07:37 | gasche | Status | new => resolved |
| 2012-02-09 07:37 | gasche | Resolution | open => no change required |
| 2012-02-09 07:37 | gasche | Assigned To | => gasche |
| Copyright © 2000 - 2011 MantisBT Group |