chore(tests/lean): fix tests, and environment.decl_pos

This commit is contained in:
Leonardo de Moura 2017-02-21 11:21:02 -08:00
parent 9413f132c0
commit 7e6a10bd1b
10 changed files with 19 additions and 19 deletions

View file

@ -79,7 +79,7 @@ meta constant trans_for : environment → name → option name
The result is none if d was not defined in an imported file. -/
meta constant decl_olean : environment → name → option string
/- (decl_pos env d) returns the source location of d if available. -/
meta constant decl_pos_info : environment → name → option pos
meta constant decl_pos : environment → name → option pos
open expr
meta constant unfold_untrusted_macros : environment → expr → expr

View file

@ -25,10 +25,10 @@ meta def rstep {α : Type} (line : nat) (col : nat) (t : mytac α) : mytac unit
meta def execute (tac : mytac unit) : tactic unit :=
tac 0 >> return ()
meta def save_info (line col : nat) : mytac unit :=
meta def save_info (p : pos) : mytac unit :=
do v ← state_t.read,
s ← tactic.read,
tactic.save_info_thunk line col
tactic.save_info_thunk p
(λ _, to_fmt "Custom state: " ++ to_fmt v ++ format.line ++
tactic_state.to_format s)

View file

@ -25,10 +25,10 @@ meta def rstep {α : Type} (line : nat) (col : nat) (t : mytac α) : mytac unit
meta def execute (tac : mytac unit) : tactic unit :=
tac (name_map.mk nat) >> return ()
meta def save_info (line col : nat) : mytac unit :=
meta def save_info (p : pos) : mytac unit :=
do v ← state_t.read,
s ← tactic.read,
tactic.save_info_thunk line col
tactic.save_info_thunk p
(λ _, to_fmt "Custom state: " ++ to_fmt v ++ format.line ++
tactic_state.to_format s)

View file

@ -9,10 +9,10 @@ return (to_fmt "<curr file>")
meta def pos_info (fn : name) : vm format :=
do {
d ← vm.get_decl fn,
some (line, col) ← return (vm_decl.pos d) | failure,
file ← get_file fn,
return (file ++ ":" ++ line ++ ":" ++ col)
d ← vm.get_decl fn,
some pos ← return (vm_decl.pos d) | failure,
file ← get_file fn,
return (file ++ ":" ++ pos.1 ++ ":" ++ pos.2)
}
<|>
return (to_fmt "<position not available>")

View file

@ -9,10 +9,10 @@ return (to_fmt "<curr file>")
meta def pos_info (fn : name) : vm format :=
do {
d ← vm.get_decl fn,
some (line, col) ← return (vm_decl.pos d) | failure,
d ← vm.get_decl fn,
some pos ← return (vm_decl.pos d) | failure,
file ← get_file fn,
return (file ++ ":" ++ line ++ ":" ++ col)
return (file ++ ":" ++ pos.1 ++ ":" ++ pos.2)
}
<|>
return (to_fmt "<position not available>")

View file

@ -5,9 +5,9 @@ def g : nat → nat :=
meta def show_pos (n : name) : command :=
do env ← get_env,
pos ← returnopt (env^.decl_pos_info n),
pos ← returnopt (env^.decl_pos n),
olean ← returnopt (env^.decl_olean n) <|> return "current file",
trace $ to_string n ++ " was defined at " ++ olean ++ " : " ++ to_string pos
trace $ to_string n ++ " was defined at " ++ olean ++ " : " ++ to_string pos.1 ++ ":" ++ to_string pos.2
run_command show_pos `add
run_command show_pos `nat.succ

View file

@ -1,5 +1,5 @@
open tactic
meta def list_name.to_expr (n : list name) : tactic expr := to_expr (quote n)
meta def my_attr : caching_user_attribute (name → bool) :=
{ name := "my_attr",
descr := "my attr",

View file

@ -1,5 +1,5 @@
open tactic
meta def nat.to_expr (n : nat) : tactic expr := to_expr (quote n)
run_command attribute.fingerprint `reducible >>= trace
definition ex0 : nat :=

View file

@ -29,10 +29,10 @@ meta def rstep {α : Type} (line : nat) (col : nat) (t : mytac α) : mytac unit
meta def execute (tac : mytac unit) : tactic unit :=
tac 0 >> return ()
meta def save_info (line col : nat) : mytac unit :=
meta def save_info (p : pos) : mytac unit :=
do v ← state_t.read,
s ← tactic.read,
tactic.save_info_thunk line col
tactic.save_info_thunk p
(λ _, to_fmt "Custom state: " ++ to_fmt v ++ format.line ++
tactic_state.to_format s)

View file

@ -15,7 +15,7 @@ meta definition mk_defs : nat → command
| 0 := skip
| (n+1) := do
N ← to_expr `(nat),
v ← n^.to_expr,
v ← to_expr (quote n),
add_decl (declaration.defn (name.append_after `val n) [] N v reducibility_hints.opaque tt),
mk_defs n