lean4-htt/tests/lean/caching_user_attribute.lean
Leonardo de Moura 572751c56e feat(frontends/lean): force user to use meta keyword on meta inductive/structure/class
Before this commit, we were inferring whether an
inductive/structure/class were meta or not. This was bad since the user
had no clue whether the type was trusted (non meta) or not.
Moreover, users could get confused by this behavior and assume the
kernel was allowing trusted code to rely on untrusted one.
2016-09-29 17:56:35 -07:00

29 lines
791 B
Text

meta def foo_attr : caching_user_attribute :=
{ name := `foo, descr := "bar", Cache := string, cache := list.join ∘ list.map (list.append "\n" ∘ to_string ∘ declaration.to_name) }
run_command attribute.register `foo_attr
attribute [foo] eq.refl eq.mp
set_option trace.user_attributes_cache true
run_command do
s : string ← caching_user_attribute.get_cache foo_attr,
tactic.trace s
run_command do
s : string ← caching_user_attribute.get_cache foo_attr,
tactic.trace s
attribute [foo] eq.mpr
local attribute [-foo] eq.mp
run_command do
s : string ← caching_user_attribute.get_cache foo_attr,
tactic.trace s
attribute [reducible] eq.mp -- should not affect [foo] cache
run_command do
s : string ← caching_user_attribute.get_cache foo_attr,
tactic.trace s