Compare commits
No commits in common. "56966b27cf205916975f5ce519961ea5163b1859" and "beb837ccabf9a4856114022ec239d41c84dc82b2" have entirely different histories.
56966b27cf
...
beb837ccab
|
@ -85,7 +85,6 @@ def execute (command: Protocol.Command): MainM Lean.Json := do
|
||||||
return .ok {
|
return .ok {
|
||||||
type := ← serialize_expression state.options info.type,
|
type := ← serialize_expression state.options info.type,
|
||||||
value? := ← value?.mapM (λ v => serialize_expression state.options v),
|
value? := ← value?.mapM (λ v => serialize_expression state.options v),
|
||||||
publicName? := Lean.privateToUserName? name |>.map (·.toString),
|
|
||||||
typeDependency? := if args.dependency?.getD false then .some <| info.type.getUsedConstants.map (λ n => name_to_ast n) else .none,
|
typeDependency? := if args.dependency?.getD false then .some <| info.type.getUsedConstants.map (λ n => name_to_ast n) else .none,
|
||||||
valueDependency? := if args.dependency?.getD false then info.value?.map (·.getUsedConstants.map (λ n => name_to_ast n)) else .none,
|
valueDependency? := if args.dependency?.getD false then info.value?.map (·.getUsedConstants.map (λ n => name_to_ast n)) else .none,
|
||||||
module? := module?
|
module? := module?
|
||||||
|
|
|
@ -120,8 +120,6 @@ structure LibInspectResult where
|
||||||
type: Expression
|
type: Expression
|
||||||
value?: Option Expression := .none
|
value?: Option Expression := .none
|
||||||
module?: Option String
|
module?: Option String
|
||||||
-- If the name is private, displays the public facing name
|
|
||||||
publicName?: Option String := .none
|
|
||||||
typeDependency?: Option (Array String) := .none
|
typeDependency?: Option (Array String) := .none
|
||||||
valueDependency?: Option (Array String) := .none
|
valueDependency?: Option (Array String) := .none
|
||||||
deriving Lean.ToJson
|
deriving Lean.ToJson
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
import Lean
|
import Lean.Declaration
|
||||||
|
|
||||||
namespace Pantograph
|
namespace Pantograph
|
||||||
|
|
||||||
def is_symbol_unsafe_or_internal (n: Lean.Name) (info: Lean.ConstantInfo): Bool :=
|
def is_symbol_unsafe_or_internal (n: Lean.Name) (info: Lean.ConstantInfo): Bool :=
|
||||||
isLeanSymbol n ∨ (Lean.privateToUserName? n |>.map isLeanSymbol |>.getD false) ∨ info.isUnsafe
|
let nameDeduce: Bool := match n.getRoot with
|
||||||
where
|
| .str _ name => name.startsWith "_" ∨ name == "Lean"
|
||||||
isLeanSymbol (name: Lean.Name): Bool := match name.getRoot with
|
| _ => true
|
||||||
| .str _ name => name == "Lean"
|
let stemDeduce: Bool := match n with
|
||||||
| _ => true
|
| .anonymous => true
|
||||||
|
| .str _ name => name.startsWith "_"
|
||||||
|
| .num _ _ => true
|
||||||
|
nameDeduce ∨ stemDeduce ∨ info.isUnsafe
|
||||||
|
|
||||||
def to_compact_symbol_name (n: Lean.Name) (info: Lean.ConstantInfo): String :=
|
def to_compact_symbol_name (n: Lean.Name) (info: Lean.ConstantInfo): String :=
|
||||||
let pref := match info with
|
let pref := match info with
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
namespace Pantograph
|
namespace Pantograph
|
||||||
|
|
||||||
def version := "0.2.10"
|
def version := "0.2.9"
|
||||||
|
|
||||||
end Pantograph
|
end Pantograph
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
import LSpec
|
|
||||||
import Pantograph.Serial
|
|
||||||
import Pantograph.Symbol
|
|
||||||
|
|
||||||
namespace Pantograph.Test.Catalog
|
|
||||||
|
|
||||||
open Pantograph
|
|
||||||
open Lean
|
|
||||||
|
|
||||||
def test_symbol_visibility (env: Environment): IO LSpec.TestSeq := do
|
|
||||||
let entries: List (Name × Bool) := [
|
|
||||||
("Nat.add_comm".toName, false),
|
|
||||||
("Lean.Name".toName, true),
|
|
||||||
("_private.Init.0.Lean.Name".toName, true)
|
|
||||||
]
|
|
||||||
let suite := entries.foldl (λ suites (symbol, target) =>
|
|
||||||
let constant := env.constants.find! symbol
|
|
||||||
let test := LSpec.check symbol.toString ((is_symbol_unsafe_or_internal symbol constant) == target)
|
|
||||||
LSpec.TestSeq.append suites test) LSpec.TestSeq.done
|
|
||||||
return suite
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def suite: IO LSpec.TestSeq := do
|
|
||||||
let env: Environment ← importModules
|
|
||||||
(imports := #["Init"].map (λ str => { module := str.toName, runtimeOnly := false }))
|
|
||||||
(opts := {})
|
|
||||||
(trustLevel := 1)
|
|
||||||
|
|
||||||
return LSpec.group "Catalog" $
|
|
||||||
(LSpec.group "Symbol visibility" (← test_symbol_visibility env))
|
|
||||||
|
|
||||||
end Pantograph.Test.Catalog
|
|
|
@ -1,5 +1,4 @@
|
||||||
import LSpec
|
import LSpec
|
||||||
import Test.Catalog
|
|
||||||
import Test.Holes
|
import Test.Holes
|
||||||
import Test.Integration
|
import Test.Integration
|
||||||
import Test.Proofs
|
import Test.Proofs
|
||||||
|
@ -14,8 +13,7 @@ def main := do
|
||||||
Holes.suite,
|
Holes.suite,
|
||||||
Integration.suite,
|
Integration.suite,
|
||||||
Proofs.suite,
|
Proofs.suite,
|
||||||
Serial.suite,
|
Serial.suite
|
||||||
Catalog.suite
|
|
||||||
]
|
]
|
||||||
let all ← suites.foldlM (λ acc m => do pure $ acc ++ (← m)) LSpec.TestSeq.done
|
let all ← suites.foldlM (λ acc m => do pure $ acc ++ (← m)) LSpec.TestSeq.done
|
||||||
LSpec.lspecIO $ all
|
LSpec.lspecIO $ all
|
||||||
|
|
Loading…
Reference in New Issue