| Anonymous | Login | Signup for a new account | 2013-05-20 18:39 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 | |||
| 0002550 | OCaml | OCaml general | public | 2004-05-05 09:50 | 2012-01-27 22:12 | |||
| Reporter | administrator | |||||||
| Assigned To | ||||||||
| Priority | normal | Severity | feature | Reproducibility | always | |||
| Status | closed | Resolution | fixed | |||||
| Platform | OS | OS Version | ||||||
| Product Version | ||||||||
| Target Version | Fixed in Version | 3.09.0 | ||||||
| Summary | 0002550: typing error instead of scoping error | |||||||
| Description | Full_Name: Daniel Weil Version: 3.07 OS: win32 Submission from: 81.80.88.226 (81.80.88.226) Suppose you have the file "toto.ml" containing the data: type 'a t = A of 'a | B let f () = Toto.B and the file "toto.mli" containing the data: type 'a t = A of 'a | B val f : unit -> 'a t When I compile first the .ml file (with "ocaml -c toto.ml"), I get a scoping error which is good. But when i compile first the .mli and the the .ml (ocamlc -c toto.mli; ocamlc -c toto.ml), I have a surprising typing error : The implementation toto.ml does not match the interface toto.cmi: Values do not match: val f : unit -> 'a Toto.t is not included in val f : unit -> 'a t I looks like a bug with separate compilation because it does not happen if i put in a single file the module toto constrained by its signature. | |||||||
| Tags | No tags attached. | |||||||
| Attached Files | ||||||||
Notes |
|
|
(0000216) administrator (administrator) 2004-05-28 05:14 |
> Suppose you have the file "toto.ml" containing the data: > type 'a t = A of 'a | B > let f () = Toto.B > > and the file "toto.mli" containing the data: > type 'a t = A of 'a | B > val f : unit -> 'a t > > When I compile first the .ml file (with "ocaml -c toto.ml"), I get a scoping > error which is good. > > But when i compile first the .mli and the the .ml (ocamlc -c toto.mli; ocamlc -c > toto.ml), I have a surprising typing error : > > The implementation toto.ml does not match the interface toto.cmi: > Values do not match: > val f : unit -> 'a Toto.t > is not included in > val f : unit -> 'a t This could be a FAQ: using the module name Toto inside a file toto.ml has no well-defined meaning, so you shouldn't do that. But maybe we could add a special error message for that? (for instance, adding a check in Env.find_pers_structure; but we need to know which file we are compiling...) Jacques |
|
(0000217) administrator (administrator) 2004-05-28 05:14 |
Improve the error message? (JG) |
|
(0000218) administrator (administrator) 2004-06-09 13:40 |
For me, it looks more like a bug of the CAML compiler : The compiler should - first infer the signature of the ml file (no matter if the .cmi exists or not) and fail if any scoping/typing error is encountered - and then only compare this signature to the .cmi file. Daniel Jacques Garrigue <caml-bugs@pauilla Pour : daniel_weil@ds-fr.com c.inria.fr> cc : caml@pauillac.inria.fr Objet : Re: typing error instead of scoping error (PR#2550) 05/28/2004 05:14 AM > Suppose you have the file "toto.ml" containing the data: > type 'a t = A of 'a | B > let f () = Toto.B > > and the file "toto.mli" containing the data: > type 'a t = A of 'a | B > val f : unit -> 'a t > > When I compile first the .ml file (with "ocaml -c toto.ml"), I get a scoping > error which is good. > > But when i compile first the .mli and the the .ml (ocamlc -c toto.mli; ocamlc -c > toto.ml), I have a surprising typing error : > > The implementation toto.ml does not match the interface toto.cmi: > Values do not match: > val f : unit -> 'a Toto.t > is not included in > val f : unit -> 'a t This could be a FAQ: using the module name Toto inside a file toto.ml has no well-defined meaning, so you shouldn't do that. But maybe we could add a special error message for that? (for instance, adding a check in Env.find_pers_structure; but we need to know which file we are compiling...) Jacques |
|
(0006838) doligez (manager) 2012-01-27 22:12 |
This was fixed at some point between 3.08.0 and 3.09.0. I now get the same (correct) error message in both cases. |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2005-11-18 10:13 | administrator | New Issue | |
| 2012-01-27 22:12 | doligez | Note Added: 0006838 | |
| 2012-01-27 22:12 | doligez | Status | acknowledged => closed |
| 2012-01-27 22:12 | doligez | Resolution | open => fixed |
| 2012-01-27 22:12 | doligez | Fixed in Version | => 3.09.0 |
| 2012-01-27 22:12 | doligez | Description Updated | View Revisions |
| Copyright © 2000 - 2011 MantisBT Group |