Skip to content
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

Reenable warning 22 across the codebase #14361

Merged
merged 5 commits into from
Feb 23, 2024
Merged

Reenable warning 22 across the codebase #14361

merged 5 commits into from
Feb 23, 2024

Conversation

nholland94
Copy link
Member

Disabling warning 22 hides a variety of important warnings, including warnings regarding unused variables. This PR reenables this warning across all libraries, and patches up those libraries so that no warnings are triggered. As part of this, I disabled a lint in ppx_version where we do not allow stable type versions other than Stable.Latest to be referenced outside of [%%versioned: ...] blocks. I do not believe this check is necessary, and there are many places in the codebase where we are interested in referencing the old type versions.

@nholland94 nholland94 requested review from a team as code owners October 17, 2023 17:21
@nholland94
Copy link
Member Author

!ci-build-me

, Global_slot_span.Stable.V1.t
, Balance.Stable.V1.t
, Amount.Stable.V1.t )
, Global_slot_since_genesis.Stable.Latest.t
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can these types omit the Stable.Latest, so Global_slot_since_genesis.t, for example. That's the same type.

( Payload.Stable.V2.t
, Public_key.Stable.V1.t
, Signature.Stable.V1.t )
( Payload.Stable.Latest.t
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should do this. A versioned type should be built from other specific versioned types. If those other types add new versions, this type will change.

It is true that the new version linter will detect such changes, but still.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is also true that this is a signature, not an implementation. But still ...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed these to get around the ppx_version warning, but have since disabled it, so I can undo all of these changes to refer to the latest versions.

let versioned_type_misuse_errors_fun =
if not @@ in_versioned_type_module acc.module_path then
get_versioned_type_misuses
else if not acc.in_versioned_ext then not_in_versioned_ext_fun
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if you allow mentions of specific versions, don't you want to keep the lint warning when a versioned type is used without %%verioned?

For example, this type declaration currently generates a warning:

module Foo = struct
  module Stable	= struct
    module V1 =	struct
      type t = int
    end
  end
end

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. So then we still want to return not_in_versioned_ext_fun if in_versioned_type_module acc.module_path && not acc.in_versioned_ext?

@mrmr1993
Copy link
Member

!ci-build-me

@mrmr1993
Copy link
Member

!ci-build-me

@mrmr1993
Copy link
Member

!approved-for-mainnet

@mrmr1993 mrmr1993 merged commit e3c496d into berkeley Feb 23, 2024
37 of 40 checks passed
@mrmr1993 mrmr1993 deleted the enable-warning-22 branch February 23, 2024 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants