Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005939OCamlOCaml generalpublic2013-03-06 18:562013-07-12 18:15
Reporterfrisch 
Assigned Todoligez 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusconfirmedResolutionopen 
PlatformOSOS Version
Product Version 
Target Version4.01.1+devFixed in Version 
Summary0005939: "fun (type t) when cond -> ..." should be rejected, maybe also "fun p when cond -> ..."
DescriptionI found the following when trying to clean up the Parsetree by putting Pexp_when clauses where they belong in the AST:

# fun (type t) when false -> 0;;
>> Fatal error: exit(0) outside appropriated catch
Fatal error: exception Misc.Fatal_error

The fix is not difficult (either in the parser or in the type-checker). But I'm wondering whether it make sense to keep the syntax:

 fun pat when cond -> ...

which necessarily triggers warning 25 (bad style, all clauses in this pattern-matching are guarded).

The Parsetree cleanup would be a little bit simpler if we got rid of this form as well. I doubt anyone uses it. I propose to get rid of it, after (i) asking on the caml-list if anyone objects; (ii) using OPAM to check that the construction is indeed not used in any of the packaged software.
TagsNo tags attached.
Attached Files

- Relationships
related to 0005936confirmed Weird syntax accepted by OCaml 

-  Notes
(0009085)
frisch (developer)
2013-04-12 13:51

0005936 seems to confirm that "fun pat when cond -> expr" can be removed with no harm.
(0009113)
frisch (developer)
2013-04-15 18:24

Commit 13528 on branch extension_points introduces an explicit representation of "cases" with an optional guard in order to get rid of the ugly Pexp_when. It also remove support for the construction "fun pat when cond -> expr". So, please don't remove it from the trunk, this will be part of the merge of extension_points.
(0009226)
frisch (developer)
2013-04-29 16:34

Setting Target Version = 4.02 (already fixed in extension_points, which will hopefully be merged in time for 4.02).

- Issue History
Date Modified Username Field Change
2013-03-06 18:56 frisch New Issue
2013-03-07 15:50 doligez Status new => confirmed
2013-04-12 13:49 frisch Relationship added related to 0005936
2013-04-12 13:51 frisch Note Added: 0009085
2013-04-15 18:24 frisch Note Added: 0009113
2013-04-25 17:05 doligez Assigned To => doligez
2013-04-25 17:05 doligez Status confirmed => assigned
2013-04-25 17:06 doligez Status assigned => confirmed
2013-04-29 16:34 frisch Note Added: 0009226
2013-04-29 16:34 frisch Target Version => 4.02.0+dev
2013-07-12 18:15 doligez Target Version 4.02.0+dev => 4.01.1+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker