-
Notifications
You must be signed in to change notification settings - Fork 1.2k
warning on use of an identifier shadowed by module open -- feature implemented, but refinements still possible #5980
Description
Original bug ID: 5980
Reporter: @dbuenzli
Assigned to: @alainfrisch
Status: acknowledged (set by @gasche on 2016-10-14T20:19:58Z)
Resolution: reopened
Priority: normal
Severity: feature
Version: 4.00.1
Fixed in version: 4.01.0+dev
Category: typing
Has duplicate: #6428
Related to: #7386
Child of: #6951
Monitored by: @jmeber @hcarty
Bug description
While generally useful I think that the M.() notation may sometimes lead to subtle bugs when used as an expression.
Suppose I have M with this signature:
module M : sig
type t
val id : t
val ( + ) : t -> t -> t
...
endAnd I code this function:
let f () =
let (id : t) = ... in
let (c : t) = ... in
M.(id + c)
I would like a warning that tells me that in M.(id + c), id is overriding a local variable. Note that a few cases are already covered by current warnings/errors.
-
If the local id not used elsewhere in f you will have (an initially puzzling) unused variable warning -- however that warning doesn't cover pattern matching variables.
-
If M.id was of another type you'd get an (aswell puzzling) type mismatch error.
I think that failing to have such a warning by default somehow renders all M.(e), where e binds local variables quite brittle and suspicious.
Thanks,
Daniel
Additional information
[Gabriel Scherer]: I reopened this bug to track the suggestion from Peter Urkedal reported in
#5980#c14317