Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005596OCamlOCaml generalpublic2012-04-18 16:482013-08-31 12:49
ReporterBoris Yakobowski 
Assigned Tofrisch 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0005596: Erroneous warning on unused private constructor
Description---------- mli -------------
module C : sig
  type t
  val inject : t
end
---------- ml -------------
module C : sig
  type t = private I
  val inject : t
end =
  struct
    type t = I
    let inject = I
  end
let _v = C.inject
---------------------------

Constructor I is incorrectly marked as unused.
Additional InformationSvn 12372
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0007380)
frisch (developer)
2012-04-18 20:08
edited on: 2012-04-18 20:46

Well spotted. In your example, it is not wrong to say that I is unused (you can turn the private definition in an abstract one!). But clearly, something is wrong: if there were other constructors in the same sum type, it would not possible to remove that one (and one might want to use this constructor only in patterns). I think one needs a different treatment for sum type definitions in module interfaces so as not to report them as being unused.

Another example is:

module F(X : sig type t = A | B end) = struct
  let f = function X.A -> 0 | X.B -> 1
end

(0007381)
frisch (developer)
2012-04-18 20:46
edited on: 2012-04-18 20:47

Fixed in trunk (commit 12378) and 4.00 (commit 12379). Constructors in signatures are no longer reported as unused.


- Issue History
Date Modified Username Field Change
2012-04-18 16:48 Boris Yakobowski New Issue
2012-04-18 20:02 frisch Assigned To => frisch
2012-04-18 20:02 frisch Status new => assigned
2012-04-18 20:08 frisch Note Added: 0007380
2012-04-18 20:14 frisch Note Edited: 0007380 View Revisions
2012-04-18 20:46 frisch Note Added: 0007381
2012-04-18 20:46 frisch Note Edited: 0007380 View Revisions
2012-04-18 20:47 frisch Note Edited: 0007381 View Revisions
2012-04-20 17:03 frisch Status assigned => resolved
2012-04-20 17:03 frisch Resolution open => fixed
2013-08-31 12:49 xleroy Status resolved => closed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker