|Anonymous | Login | Signup for a new account||2017-10-20 23:30 CEST|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0006035||OCaml||typing||public||2013-06-07 16:35||2015-12-11 19:19|
|Priority||normal||Severity||minor||Reproducibility||have not tried|
|Target Version||Fixed in Version||4.01.0+dev|
|Summary||0006035: Multiple declarations of the same method in the same object should be rejected|
|Description||let c = object|
method x = 0
method x = 0
is currently accepted, and trigger the warning 7 (method x is overridden) on the second occurrence. I propose to consider it an error when a method overrides another method defined in the same object (which is thus useless), even the method is marked with "!".
We have been bitten by not having the compiler complain on a code like:
let c = object
method! init = ...
method! init = ...
The proposed change is not difficult to implement, but it could potentially break existing (bad) code. We could also create a new warning, but since it will report code which is clearly wrong and trivial to fix, it would make more sense to have an error.
|Tags||No tags attached.|
|Commit 13756 in trunk.|
|Keeping this open for a few days, in case anyone wants to complain.|
|Nobody complained. The new behavior is documented in the manual.|
edited on: 2013-06-13 15:50
Personally, I believe this error is a good idea. With that said, this will cause breakage in some libraries with (benign) method duplication. For instance, ocamlnet 3.6.0, 3.6.3, and 3.6.5 have identical 'stat' methods in netpop. See https://github.com/OCamlPro/opam-repository/pull/796 [^] for more info and the OPAM patch.
I'm not really sure what you'll do with this information but gasche told me to report here for your edification. Also, there was some speculation about this sort of problem being caused by a silent merge bug.
Gerd has also been notified via ocamlnet-devel.
|Bah! Clearly that URL should not end with ">" as that's an invalid character for a URI, Mantis regex.|
|Thanks for the information. I see it as a good think that the compiler spots the problem, especially since the fix is trivial.|
|2013-06-07 16:35||frisch||New Issue|
|2013-06-07 17:37||frisch||Note Added: 0009437|
|2013-06-07 17:37||frisch||Assigned To||=> frisch|
|2013-06-07 17:37||frisch||Status||new => assigned|
|2013-06-07 17:37||frisch||Note Added: 0009438|
|2013-06-07 17:37||frisch||Fixed in Version||=> 4.01.0+dev|
|2013-06-12 17:12||frisch||Note Added: 0009463|
|2013-06-12 17:12||frisch||Status||assigned => resolved|
|2013-06-12 17:12||frisch||Resolution||open => fixed|
|2013-06-13 15:23||dsheets||Note Added: 0009479|
|2013-06-13 15:31||dsheets||Note Added: 0009480|
|2013-06-13 15:50||frisch||Note Edited: 0009479||View Revisions|
|2013-06-13 15:52||frisch||Note Added: 0009481|
|2015-12-11 19:19||xleroy||Status||resolved => closed|
|2017-02-23 16:45||doligez||Category||OCaml typing => typing|
|Copyright © 2000 - 2011 MantisBT Group|