Should `.below` be marked as private/internal?
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 9.2k
- Forks
- 990
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 175
Description
See for example
#check List.Sublist.below.cons
List.Sublist.below.cons.{u_1} {α : Type u_1} :
∀ {motive : (a a_1 : List α) → a.Sublist a_1 → Prop} {l₁ l₂ : List α} (a : α) {a_1 : l₁.Sublist l₂},
a_1.below → motive l₁ l₂ a_1 → ⋯.below
In tests/lean/run/constructor_as_variable.lean we now see the error:
error: invalid pattern, constructor or constant marked with '[match_pattern]' expected
Suggestions: 'List.Sublist.below.cons', 'List.Sublist.cons', 'List.cons'
on the test
def ctorSuggestion2 (list : List α) : Nat :=
match list with
| nil => 0
| cons x xs => 1 + ctorSuggestion2 xs
These .below auxiliary functions are rarely (never?) meant to be used by users, and perhaps should be marked as private or internal in some way, so they would not be displayed here.
There is already a check for isPrivateName when generating this message.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read src/Lean/Elab/PatternVar.lean, especially the existing isPrivateName check, and reproduce the diagnostic with tests/lean/run/constructor_as_variable.lean. Determine how the .below auxiliary functions should be classified, then verify that constructor suggestions no longer display them while retaining useful suggestions such as List.cons.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100