-
Notifications
You must be signed in to change notification settings - Fork 946
chore: ignore autoparam declarations in private module linter #32597
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
chore: ignore autoparam declarations in private module linter #32597
Conversation
PR summary 151fb3b204Import changes for modified filesNo significant changes to the import graph Import changes for all files
Declarations diffNo declarations were harmed in the making of this PR! 🐙 You can run this locally as follows## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>
## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>The doc-module for No changes to technical debt.You can run this locally as
|
|
Thank you for the prompt investigation and making at least a band-aid fix! If this works, you should see CI fail because of |
|
I've now tested not counting any We should indeed always consider Code:module
import Mathlib.Tactic.Attr.Core
import Mathlib.Tactic.Bound.Init
import Mathlib.Tactic.Measurability.Init
import Mathlib.Tactic.ArithMult.Init
import Mathlib.Combinatorics.Matroid.Init
import Mathlib.Combinatorics.SimpleGraph.Init
import Mathlib.Data.Sym.Sym2.Init
import Mathlib.Topology.Sheaves.Init
import Mathlib.Data.Finset.Attr
import Mathlib.Tactic.Continuity.Init
import Mathlib.Tactic.Finiteness.Attr
open Lean
def modNames := #[
`Mathlib.Tactic.Attr.Core,
`Mathlib.Tactic.Bound.Init,
`Mathlib.Tactic.Measurability.Init,
`Mathlib.Tactic.ArithMult.Init,
`Mathlib.Combinatorics.Matroid.Init,
`Mathlib.Combinatorics.SimpleGraph.Init,
`Mathlib.Data.Sym.Sym2.Init,
`Mathlib.Topology.Sheaves.Init,
`Mathlib.Data.Finset.Attr,
`Mathlib.Tactic.Continuity.Init,
`Mathlib.Tactic.Finiteness.Attr
]
run_cmd do
let env ← getEnv
let modIdxs? := modNames.map fun n =>
env.header.moduleNames.findIdx? (· == n)
if modIdxs?.any (·.isNone) then throwError "could not find some module"
let mut importedConsts := #[]
for (name,_) in (← getEnv).constants.map₁ do
if let some idx := modIdxs?.idxOf? <| (← getEnv).getModuleIdxFor? name then
importedConsts := importedConsts.push (MessageData.ofConstName name, modNames[idx]!)
logInfo m!"{importedConsts.qsort (·.2.lt ·.2)}" |
|
Do you think it's easy to add a test for |
|
Ah, good point. :) |
|
I've rescinded the comment about |
|
This issue will be fixed in lean4#11581, so let's close this. I'll move the
|
|
Actually, just to consider all possibilities: @grunweg, do you think we ought to have this as a temporary fix before lean4#11581 lands in mathlib (and change the documentation to describe it as such), then clean it up later? Do you know approximately how long it will be before the fix makes its way to mathlib, assuming it's merged shortly? I'd rather spare the churn, but if it'll be a while... :) |
|
The fix got merged already, so that part is clear :-) If it's backported, it can be in next week's release (i.e., land in mathlib in roughly a week); otherwise a week longer. I've asked on zulip. |
Autogenerated declarations for the syntax of autoparams never start with
_private, and thus are in some sense always public. We manually exclude them from the class of public declarations here.Note that something like
isInternalDetailis too strong; that would also exclude public declarations generated byinitialize, which ought to be considered bona-fide public declarations.We add
@[expose] public sectiontoMathlib.Analysis.Normed.Lp.SmoothApprox.