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

Shouldn't warn about unused constructors when there is an equation #5601

Closed
vicuna opened this issue Apr 25, 2012 · 1 comment
Closed

Shouldn't warn about unused constructors when there is an equation #5601

vicuna opened this issue Apr 25, 2012 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Apr 25, 2012

Original bug ID: 5601
Reporter: @garrigue
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2013-08-31T10:49:06Z)
Resolution: fixed
Priority: high
Severity: minor
Version: 4.00.0+dev
Category: typing

Bug description

The following code causes two warnings:

module M = struct type t = A end;;

module M : sig type t = A end

module G : sig end = struct type d = M.t = A end;;

Warning 34: unused type d.
Warning 37: unused constructor A.

Warning 34 is correct since d is defined but never used.
However warning 37 is wrong, since A comes from M.t, and one can build values using M.t.

I looked at the code, but couldn't determine how to fix that.

@vicuna
Copy link
Author

vicuna commented Apr 25, 2012

Comment author: @alainfrisch

Thanks. Fixed in trunk (12397) and 4.00 (12398).

The current strategy for detecting unused constructors is rather constraining. Ideally, one should merge "usage markers" when a constructor is re-exported so to consider all the declarations for the same constructor as a single one. This can be done later.

@vicuna vicuna closed this as completed Aug 31, 2013
@vicuna vicuna added the bug label Mar 20, 2019
dra27 pushed a commit to dra27/ocaml that referenced this issue Feb 27, 2021
… equation. (Cheery-picked from trunk commit 12397.)

git-svn-id: http://caml.inria.fr/svn/ocaml/version/4.00@12398 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants