disable warning 30 (same constructor/label used in two mutually-recursive declarations)#9046
Conversation
dfaa169 to
92a260f
Compare
…sive decls)
Warning 30 warns when the same constructor/label is used in two
mutually-recursive type declarations. This warning (added in OCaml
3.12, 2010) was meaningful at the time where constructor/label
conflicts had a shadowing semantics: the "last" definition would mean,
while ideally mutually-recursive definitions should not be strictly
ordered but defined "all at once".
Since OCaml 4.01 (2013) we support type-based disambiguation of
constructor/label names and it is now common to write code such as,
say
type pattern = Var of var | ...
type expr = Var of var | ...
(no warning, of course). But warning 30 fires if you instead write
type pattern = Var of var | ...
and expr = Var of var | ...
This doesn't make much sense, and in particular it certainly makes no
sense to enable this warning by default. The present PR disables it by
default.
|
@Drup if you like the PR, would you mind approving it? (Or maybe you like it but you are not sure it should be merged?) |
|
In general for warnings we would have to be fairly careful with the default settings (they affect the language model and require Serious Consensus to be changed), but in this particular I'm pretty sure that everyone just forgot about this warning and it's a mistake that it slipped through unnoticed so far. (Probably because most existing codebases didn't start using same-constructor-names overnight so we didn't notice it.) The reason I created this PR now is that a new intern of mine just wrote code that fell on this warning, and that was a bad user experience. I thus propose to move on and merge as the CI is green. @trefis, does that sound reasonable to you? |
|
It does. Although if you want to be extra careful, you could try and confirm that your explanation is correct by digging into old issues / blaming the code and looking at the commit message (or asking its author). |
|
Ah, I did the digging part already: MPR#3601 in 2010. |
Warning 30 (same constructor/label name used in two mutually-recursive declarations) is an annoying warning that makes no sense since we introduced type-based disambiguation of fields and constructors. It was disabled by default in OCaml 4.10 ocaml/ocaml#9046 and there is no reason to keep it in Dune. Signed-off-by: Gabriel Scherer <gabriel.scherer@gmail.com>
Warning 30 (same constructor/label name used in two mutually-recursive declarations) is an annoying warning that makes no sense since we introduced type-based disambiguation of fields and constructors. It was disabled by default in OCaml 4.10 ocaml/ocaml#9046 and there is no reason to keep it in Dune. Signed-off-by: Gabriel Scherer <gabriel.scherer@gmail.com>
Warning 30 (same constructor/label name used in two mutually-recursive declarations) is an annoying warning that makes no sense since we introduced type-based disambiguation of fields and constructors. It was disabled by default in OCaml 4.10 ocaml/ocaml#9046 and there is no reason to keep it in Dune. Signed-off-by: Gabriel Scherer <gabriel.scherer@gmail.com>
Warning 30 (same constructor/label name used in two mutually-recursive declarations) is an annoying warning that makes no sense since we introduced type-based disambiguation of fields and constructors. It was disabled by default in OCaml 4.10 ocaml/ocaml#9046 and there is no reason to keep it in Dune. Signed-off-by: Gabriel Scherer <gabriel.scherer@gmail.com>
Warning 30 (same constructor/label name used in two mutually-recursive declarations) is an annoying warning that makes no sense since we introduced type-based disambiguation of fields and constructors. It was disabled by default in OCaml 4.10 ocaml/ocaml#9046 and there is no reason to keep it in Dune. Signed-off-by: Gabriel Scherer <gabriel.scherer@gmail.com>
Warning 30 (same constructor/label name used in two mutually-recursive declarations) is an annoying warning that makes no sense since we introduced type-based disambiguation of fields and constructors. It was disabled by default in OCaml 4.10 ocaml/ocaml#9046 and there is no reason to keep it in Dune. Signed-off-by: Gabriel Scherer <gabriel.scherer@gmail.com> Co-authored-by: Rudi Grinberg <me@rgrinberg.com>
Warning 30 (same constructor/label name used in two mutually-recursive declarations) is an annoying warning that makes no sense since we introduced type-based disambiguation of fields and constructors. It was disabled by default in OCaml 4.10 ocaml/ocaml#9046 and there is no reason to keep it in Dune. Signed-off-by: Gabriel Scherer <gabriel.scherer@gmail.com> Co-authored-by: Rudi Grinberg <me@rgrinberg.com>
Warning 30 (same constructor/label name used in two mutually-recursive declarations) is an annoying warning that makes no sense since we introduced type-based disambiguation of fields and constructors. It was disabled by default in OCaml 4.10 ocaml/ocaml#9046 and there is no reason to keep it in Dune. Signed-off-by: Gabriel Scherer <gabriel.scherer@gmail.com> Co-authored-by: Rudi Grinberg <me@rgrinberg.com>
Warning 30 (same constructor/label name used in two mutually-recursive declarations) is an annoying warning that makes no sense since we introduced type-based disambiguation of fields and constructors. It was disabled by default in OCaml 4.10 ocaml/ocaml#9046 and there is no reason to keep it in Dune. Signed-off-by: Gabriel Scherer <gabriel.scherer@gmail.com>
Warning 30 warns when the same constructor/label is used in two
mutually-recursive type declarations. This warning (added in OCaml
3.12, 2010) was meaningful at the time where constructor/label
conflicts had a shadowing semantics: the "last" definition would mean,
while ideally mutually-recursive definitions should not be strictly
ordered but defined "all at once".
Since OCaml 4.01 (2013) we support type-based disambiguation of
constructor/label names and it is now common to write code such as,
say
(no warning, of course). But warning 30 fires if you instead write
This doesn't make much sense, and in particular it certainly makes no
sense to enable this warning by default. The present PR disables it by
default.