Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007553OCamltypingpublic2017-06-05 10:442017-10-10 11:31
Reporterdra 
Assigned Tolpw25 
PrioritynormalSeveritytweakReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version4.05.0 +dev/beta1/beta2/beta3/rc1 
Target Version4.06.0 +dev/beta1/beta2/rc1Fixed in Version4.06.0 +dev/beta1/beta2/rc1 
Summary0007553: Warning 33 incorrectly triggered in recursive module
Descriptionjbuilder recommends a recursive module pattern to allow the content of an .mli file to be turned into an equivalent .ml file, but this appears to have unearthed a bug in Warning 33.
Steps To ReproduceCreate a.mli containing
type foo = Foo

and b.mli containing
open A
type bar = Bar of foo

then create b.ml to be
module rec B : sig
  open A                 (* i.e. the contents of b.mli *)
  type bar = Bar of foo
end = B
include B


When compiled, Warning 33 is incorrectly emitted:
$ ocamlc -w +a a.mli b.mli b.ml
File "b.ml", line 2, characters 2-8:

Warning 33: unused open A.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0017843)
lpw25 (developer)
2017-06-05 11:12

The following patch fixes it:

--- a/typing/typemod.ml
+++ b/typing/typemod.ml
@@ -393,6 +393,7 @@ and approx_sig env ssg =
           let (id, newenv) = Env.enter_modtype d.pmtd_name.txt info env in
           Sig_modtype(id, info) :: approx_sig newenv srem
       | Psig_open sod ->
+ let sod = { sod with popen_override = Override } in
           let (_path, mty, _od) = type_open env sod in
           approx_sig mty srem
       | Psig_include sincl ->

Although it would probably be better to give [type_open] a [check] parameter that turned the usage warning off rather than abuse the fact that currently [open!] doesn't trigger that warning.
(0017844)
lpw25 (developer)
2017-06-05 17:37

A more thorough fix for this and related issues:

https://github.com/ocaml/ocaml/pull/1191 [^]

- Issue History
Date Modified Username Field Change
2017-06-05 10:44 dra New Issue
2017-06-05 10:44 dra Status new => assigned
2017-06-05 10:44 dra Assigned To => garrigue
2017-06-05 10:45 dra Steps to Reproduce Updated View Revisions
2017-06-05 11:12 lpw25 Note Added: 0017843
2017-06-05 11:37 lpw25 Assigned To garrigue => lpw25
2017-06-05 17:37 lpw25 Note Added: 0017844
2017-10-10 11:31 frisch Status assigned => resolved
2017-10-10 11:31 frisch Fixed in Version => 4.06.0 +dev/beta1/beta2/rc1
2017-10-10 11:31 frisch Resolution open => fixed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker