From 3c808506c171fef208f849a4f705d2b6d3798dbe Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Fri, 4 Oct 2024 12:58:16 -0700 Subject: [PATCH] feat: Remove most filters on catalog --- Pantograph/Environment.lean | 10 +++------- Test/Environment.lean | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Pantograph/Environment.lean b/Pantograph/Environment.lean index 37faf72..ef4a40e 100644 --- a/Pantograph/Environment.lean +++ b/Pantograph/Environment.lean @@ -10,16 +10,12 @@ namespace Pantograph.Environment @[export pantograph_is_name_internal] def isNameInternal (n: Name): Bool := -- Returns true if the name is an implementation detail which should not be shown to the user. - isLeanSymbol n ∨ (Lean.privateToUserName? n |>.map isLeanSymbol |>.getD false) ∨ n.isAuxLemma ∨ n.hasMacroScopes - where - isLeanSymbol (name: Name): Bool := match name.getRoot with - | .str _ name => name == "Lean" - | _ => true + n.isAuxLemma ∨ n.hasMacroScopes /-- Catalog all the non-internal and safe names -/ @[export pantograph_environment_catalog] -def env_catalog (env: Environment): Array Name := env.constants.fold (init := #[]) (λ acc name info => - match isNameInternal name || info.isUnsafe with +def env_catalog (env: Environment): Array Name := env.constants.fold (init := #[]) (λ acc name _ => + match isNameInternal name with | false => acc.push name | true => acc) diff --git a/Test/Environment.lean b/Test/Environment.lean index 631ea54..6b418f7 100644 --- a/Test/Environment.lean +++ b/Test/Environment.lean @@ -33,7 +33,7 @@ def test_catalog: IO LSpec.TestSeq := do def test_symbol_visibility: IO LSpec.TestSeq := do let entries: List (Name × Bool) := [ ("Nat.add_comm".toName, false), - ("Lean.Name".toName, true), + ("foo.bla.Init.Data.List.Basic.2.1.Init.Lean.Expr._hyg.4".toName, true), ("Init.Data.Nat.Basic._auxLemma.4".toName, true), ] let suite := entries.foldl (λ suites (symbol, target) => -- 2.44.1