mirror of
https://github.com/leanprover/lean4.git
synced 2026-03-17 10:24:07 +00:00
fix: improve Name.isMetaprogramming (#12767)
This PR makes sure that identifiers with `Meta` or `Simproc` in their name do not show up in library search results. For example, `Nat.Simproc.eq_add_gt` can currently be suggested by library search, even though it is an implementation detail. Additionally, there are various declarations in mathlib in the `Mathlib.Meta` namespace that we do not want to suggest.
This commit is contained in:
@@ -205,7 +205,7 @@ def anyS (n : Name) (f : String → Bool) : Bool :=
|
||||
/-- Return true if the name is in a namespace associated to metaprogramming. -/
|
||||
def isMetaprogramming (n : Name) : Bool :=
|
||||
let components := n.components
|
||||
components.head? == some `Lean || (components.any fun n => n == `Tactic || n == `Linter)
|
||||
components.head?.any (· == `Lean) || (components.any (· matches `Tactic | `Linter | `Simproc | `Meta))
|
||||
|
||||
end Name
|
||||
end Lean
|
||||
|
||||
Reference in New Issue
Block a user