-
Notifications
You must be signed in to change notification settings - Fork 98
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
Add an -unused-type-warnings flag to the driver #493
Add an -unused-type-warnings flag to the driver #493
Conversation
c5ad841
to
e06ff1f
Compare
CC @mbarbin, if you want to test this feature. CC @ceastlund, I'd be curious to know if you get any warnings when enabling this flag for JS' codebase. |
I created a preview package that includes this change, and tested it in a PR in a project that could benefits from that. I was able to remove my hack and coverage stayed at 100%. 👍 |
This allows disabling the generation of `let _ = fun (_ : t) -> ()` strucutre items for each type using derivers. The feature was meant to automatically disable warning 34 when using `[@@deriving ...]` Signed-off-by: Nathan Rebours <[email protected]>
e06ff1f
to
c5ed5c6
Compare
This allows disabling the generation of `let _ = fun (_ : t) -> ()` strucutre items for each type using derivers. The feature was meant to automatically disable warning 34 when using `[@@deriving ...]` This is inspired by ocaml-ppx#493 but adapted for ocaml-ppx#510. Signed-off-by: Mathieu Barbin <[email protected]>
-------------------------------------------------------------------------------- | ||
|
||
Whenever a set of types has a [@@deriving ...] attached, ppxlib's driver always | ||
generate structure items meant to disable unused type warnings (warning 34) for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generate structure items meant to disable unused type warnings (warning 34) for | |
generates structure items meant to disable unused type warnings (warning 34) for |
We can see that the driver generated two `let _ = fun (_ : ...`, one for each type | ||
in the set. | ||
|
||
We have a flag that disable this behaviour and allows unused type warnings to be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a flag that disable this behaviour and allows unused type warnings to be | |
We have a flag that disables this behaviour and allows unused type warnings to be |
|
||
We have a flag that disable this behaviour and allows unused type warnings to be | ||
reported properly. Passing that flag to the driver should remove the two previously | ||
mentionned items. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mentionned items. | |
mentioned items. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@patricoferris I will verify how much of the original code I re-used and apply your review comments to the other branch as well. Thanks!
@patricoferris We were discussing with @NathanReb and I've made an attempt to implement this feature on top of another PR, see #511 . I am not sure which matches best what Nathan had in mind, just giving you the heads up. |
Yes this PR is a bit out of date now. Since @mbarbin started working on the right implem, I'd prefer to take his contributions! Let's close this! |
This allows disabling the generation of `let _ = fun (_ : t) -> ()` strucutre items for each type using derivers. The feature was meant to automatically disable warning 34 when using `[@@deriving ...]` This is inspired by ocaml-ppx#493 but adapted for ocaml-ppx#510. Signed-off-by: Mathieu Barbin <[email protected]>
This allows disabling the generation of `let _ = fun (_ : t) -> ()` strucutre items for each type using derivers. The feature was meant to automatically disable warning 34 when using `[@@deriving ...]` This is inspired by ocaml-ppx#493 but adapted for ocaml-ppx#510. Signed-off-by: Mathieu Barbin <[email protected]>
This allows disabling the generation of
let _ = fun (_ : t) -> ()
strucutre items for each type using derivers.The feature was meant to automatically disable warning 34 when using
[@@deriving ...]
.This is based on top of #492 to ease testing for the feature, only the last commit is relevant.