Skip to content

feat: auto-bugs#12054

Open
adomani wants to merge 48 commits intomasterfrom
adomani/test_all
Open

feat: auto-bugs#12054
adomani wants to merge 48 commits intomasterfrom
adomani/test_all

Conversation

@adomani
Copy link
Copy Markdown
Contributor

@adomani adomani commented Apr 10, 2024

mathlib-bors bot pushed a commit that referenced this pull request Apr 11, 2024
Found after examining the bug fixes in #12054, although these improvements are unrelated to the test PR.
@ghost ghost removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label May 9, 2024
@adomani adomani added awaiting-review t-meta Tactics, attributes or user commands labels May 9, 2024
@adomani adomani marked this pull request as ready for review May 9, 2024 17:14
@ghost ghost added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label May 22, 2024
@ghost ghost removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label May 25, 2024
@ghost ghost added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 14, 2024
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jul 9, 2024

PR summary a1b1d7792d

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Tactic 1
Mathlib.Tactic.Linter.MetaTesting 17

Declarations diff

+ TSyntax.getTactics
+ TSyntax.insertBack
+ TSyntax.insertMany
+ addDone
+ addHaveDone
+ addLetsOrSets
+ addPropHaves
+ addShowIdDone
+ getMetaTest
+ hif
+ insertAt
+ insertMany
+ insertRight
+ metaTest
+ test?
+ testFVs
+ testInstMVs
+ testMData
+ testTactic
+ testWhnf
+ toExample

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 script/declarations_diff.sh contains some details about this script.

@ghost ghost removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jul 9, 2024
Copy link
Copy Markdown
Contributor

@joneugster joneugster left a comment

Choose a reason for hiding this comment

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

Overall, I think this is a useful linter. I left a few comments on quesions I had.

Especially, I found it a bit hard to see immediately how to extend the linter with new tests and think some additional guidance to the unexperienced user might be useful.

One thing I cannot judge is whether everything in low_level_syntax belongs in other files.

Comment on lines +14 to +19
/--
info: Skipped since it contains 'guard_target'

Use '#meta_test cmd' if you really want to run the test on 'cmd'
-/
#guard_msgs in
Copy link
Copy Markdown
Contributor

@joneugster joneugster Jul 22, 2024

Choose a reason for hiding this comment

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

I don't understand why this is in here. If I comment it, the test still passes, but commenting the set_option above suddenly makes this fail. Is there a reason for having the #guard_msgs duplicated?

d.kind == .default && d.type.ctorName != "sort" && !(← inferType d.type).isProp
let toSet := nonSort.map Prod.snd
let (ntac, repls) ← addLetsOrSets lets? unLet? tac toSet
testTactic ntac m!"{if lets? then "'let's" else "'set's"} {repls}" m!"missing withContext? {ntac}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reading this as a non-expert it wasn't immediately obvious whether you mean "missing withContext?" or "missing withContext?" as it's not uncommon in Lean to add a ? to the name of things. same for instantiateMVars? below.

Comment on lines +288 to +292
/--
warning: goal does not match
-/
-- `goal does not match` --> not dealing with `mdata`?
#guard_msgs in
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If I uncomment any of these #guard_msgs (basically any in this entire file) then suddenly the one above it fails. It looks like #meta_test is including too much. This seems like a bug, isn't it?

Comment on lines +366 to +381
section testing_internals
open Lean Elab Parser Command Mathlib Tactic MetaTesting

run_cmd liftTermElabM do
let stx ← `(tacticSeq| exact .intro)
let gh := stx.insertMany #[(← `(tactic| guard_hyp h))]
let gt := stx.insertMany #[(← `(tactic| guard_target = h))]
guard <| (test? stx).isNone && (test? gh).isSome && (test? gt).isSome

run_cmd liftTermElabM do
let stx ← `(command| /-- -/ #guard_msgs in import)
guard <| (test? stx).isNone
let stx ← `(command| #guard_msgs in import)
guard <| (test? stx).isNone

end testing_internals
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you add a comment explaining what you are testing here?

Comment on lines +267 to +269
for test in [testMData, testFVs false false, testFVs true false, testInstMVs,
testFVs false true, testFVs true true
] do
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wonder if it would be a little bit easier for future developers if this list of tests would be extracted in it's own definition or marked better in another way. That might help understanding quickly how one adds new tests to the linter. Maybe even add an instruction to the module docstring like "you can add new tests to activeMetaTests."

Maybe not, but I think I had to read through the code just a bit too long to understand.

@joneugster joneugster added the awaiting-author A reviewer has asked the author a question or requested changes. label Jul 22, 2024
@joneugster joneugster self-assigned this Jul 22, 2024
Comment on lines +32 to +47
warning: missing withContext?

let _h : ?a✝ := _h
let _d : ?a✝¹ := _d
guard_target = _
exact 0
done
---
warning: missing withContext?

let _h : ?a✝ := _h
let _d : ?a✝¹ := _d
unfold_let at *
guard_target = _
exact 0
done
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is this message appearing (almost) duplicated? and what does it tell us, that exact has no withContext?

@ghost ghost added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jul 23, 2024
Copy link
Copy Markdown
Contributor Author

@adomani adomani left a comment

Choose a reason for hiding this comment

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

Jon, thank you for the review!

For the moment, I have simply committed the "style" changes. I will look at the more substantial comments that you left soon!

@ghost ghost removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Aug 7, 2024
@leanprover-community-bot-assistant leanprover-community-bot-assistant added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-author A reviewer has asked the author a question or requested changes. merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) t-meta Tactics, attributes or user commands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants