do scope checking in FromParser where it belongs
This commit is contained in:
parent
55c0bf9974
commit
b666bc20cf
11 changed files with 305 additions and 309 deletions
|
@ -21,10 +21,10 @@ defGlobals = fromList
|
|||
parameters (label : String) (act : Lazy (TC ()))
|
||||
{default defGlobals globals : Definitions}
|
||||
testEq : Test
|
||||
testEq = test label $ runTC [<] globals act
|
||||
testEq = test label $ runTC globals act
|
||||
|
||||
testNeq : Test
|
||||
testNeq = testThrows label (const True) $ runTC [<] globals act $> "()"
|
||||
testNeq = testThrows label (const True) $ runTC globals act $> "()"
|
||||
|
||||
|
||||
parameters (0 d : Nat) (ctx : TyContext d n)
|
||||
|
|
|
@ -61,8 +61,9 @@ parameters {c : Bool} {auto _ : Show b}
|
|||
|
||||
FromString BName where fromString = Just . fromString
|
||||
|
||||
runFromParser : Eff [Except FromParser.Error] a -> Either FromParser.Error a
|
||||
runFromParser = extract . runExcept
|
||||
runFromParser : {default empty defs : Definitions} ->
|
||||
Eff FromParserPure a -> Either FromParser.Error a
|
||||
runFromParser = map fst . fromParserPure defs
|
||||
|
||||
export
|
||||
tests : Test
|
||||
|
@ -79,7 +80,9 @@ tests = "PTerm → Term" :- [
|
|||
],
|
||||
|
||||
"terms" :-
|
||||
let fromPTerm = runFromParser .
|
||||
let defs = fromList [("f", mkDef gany Nat Zero)]
|
||||
-- doesn't have to be well typed yet, just well scoped
|
||||
fromPTerm = runFromParser {defs} .
|
||||
fromPTermWith [< "𝑖", "𝑗"] [< "A", "x", "y", "z"]
|
||||
in [
|
||||
note "dim ctx: [𝑖, 𝑗]; term ctx: [A, x, y, z]",
|
||||
|
|
|
@ -13,7 +13,7 @@ parameters {0 isRedex : RedexTest tm} {auto _ : Whnf tm isRedex} {d, n : Nat}
|
|||
private
|
||||
testWhnf : String -> WhnfContext d n -> tm d n -> tm d n -> Test
|
||||
testWhnf label ctx from to = test "\{label} (whnf)" $ do
|
||||
result <- bimap toInfo fst $ whnf [<] defs ctx from
|
||||
result <- bimap toInfo fst $ whnf defs ctx from
|
||||
unless (result == to) $ Left [("exp", show to), ("got", show result)]
|
||||
|
||||
private
|
||||
|
|
|
@ -28,7 +28,7 @@ ToInfo Error' where
|
|||
M = Eff [Except Error', DefsReader]
|
||||
|
||||
inj : TC a -> M a
|
||||
inj = rethrow . mapFst TCError <=< lift . runExcept . runReaderAt NS [<]
|
||||
inj = rethrow . mapFst TCError <=< lift . runExcept
|
||||
|
||||
|
||||
reflTy : Term d n
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue