Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning 33 incorrectly triggered in recursive module #7553

vicuna opened this issue Jun 5, 2017 · 2 comments


None yet
2 participants
Copy link

commented Jun 5, 2017

Original bug ID: 7553
Reporter: @dra27
Assigned to: @lpw25
Status: resolved (set by @alainfrisch on 2017-10-10T09:31:26Z)
Resolution: fixed
Priority: normal
Severity: tweak
Version: 4.05.0 +dev/beta1/beta2/beta3/rc1
Target version: 4.06.0 +dev/beta1/beta2/rc1
Fixed in version: 4.06.0 +dev/beta1/beta2/rc1
Category: typing

Bug description

jbuilder 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 reproduce

Create a.mli containing

type foo = Foo

and b.mli containing

open A
type bar = Bar of foo

then create 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
File "", line 2, characters 2-8:

Warning 33: unused open A.

This comment has been minimized.

Copy link

commented Jun 5, 2017

Comment author: @lpw25

The following patch fixes it:

--- a/typing/
+++ b/typing/
@@ -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.


This comment has been minimized.

Copy link

commented Jun 5, 2017

Comment author: @lpw25

A more thorough fix for this and related issues:


@vicuna vicuna closed this Oct 10, 2017

@vicuna vicuna added the typing label Mar 14, 2019

@vicuna vicuna added this to the 4.06.0 milestone Mar 14, 2019

@vicuna vicuna added the bug label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.