You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 6762 Reporter:@oandrieu Assigned to:@alainfrisch Status: closed (set by @xavierleroy on 2017-02-16T14:16:22Z) Resolution: fixed Priority: normal Severity: minor Version: 4.01.0 Target version: 4.03.0+dev / +beta1 Fixed in version: 4.03.0+dev / +beta1 Category: ~DO NOT USE (was: OCaml general) Monitored by:@gasche@hcarty
Bug description
When a variant type is re-exported in another module, opening both modules triggers the "open statement shadows the constructor". One could argue that it's not really a case of shadowing since it's the types are equivalent.
Steps to reproduce
$ cat t.ml
type tau =
| Tbool
| Tint
$ cat t2.ml
type tau = T.tau =
| Tbool
| Tint
$ cat t3.ml
open T
open T2
let is_bool = function
| Tbool -> true
| Tint -> false
$ ocamlopt -w +45 -c t.ml t2.ml t3.ml
File "t3.ml", line 2, characters 0-7:
Warning 45: this open statement shadows the constructor Tbool (which is later used)
File "t3.ml", line 2, characters 0-7:
Warning 45: this open statement shadows the constructor Tint (which is later used)
When I try to compile my programs with trunk, I got:
File "lib/functoria_misc.ml", line 18, characters 0-12:
Warning 45: this open statement shadows the constructor Ok (which is later used)
File "lib/functoria_misc.ml", line 18, characters 0-12:
Warning 45: this open statement shadows the constructor Error (which is later used)
Thanks Alain! Your patch is clean and opens the door to a principled policy of not warning when the shadowing identifier is an alias of the shadowed one, which we have already mentioned several times for terms and modules alike.
Original bug ID: 6762
Reporter: @oandrieu
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2017-02-16T14:16:22Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.01.0
Target version: 4.03.0+dev / +beta1
Fixed in version: 4.03.0+dev / +beta1
Category: ~DO NOT USE (was: OCaml general)
Monitored by: @gasche @hcarty
Bug description
When a variant type is re-exported in another module, opening both modules triggers the "open statement shadows the constructor". One could argue that it's not really a case of shadowing since it's the types are equivalent.
Steps to reproduce
$ cat t.ml
type tau =
| Tbool
| Tint
$ cat t2.ml
type tau = T.tau =
| Tbool
| Tint
$ cat t3.ml
open T
open T2
let is_bool = function
| Tbool -> true
| Tint -> false
$ ocamlopt -w +45 -c t.ml t2.ml t3.ml
File "t3.ml", line 2, characters 0-7:
Warning 45: this open statement shadows the constructor Tbool (which is later used)
File "t3.ml", line 2, characters 0-7:
Warning 45: this open statement shadows the constructor Tint (which is later used)
File attachments
The text was updated successfully, but these errors were encountered: