chore(tests): forgot to commit structure instance test

This commit is contained in:
Sebastian Ullrich 2017-11-22 18:25:30 +01:00 committed by Leonardo de Moura
parent b3587e15a3
commit 511bf69dd4
2 changed files with 50 additions and 0 deletions

View file

@ -0,0 +1,28 @@
meta def mk_c := `[exact 1]
structure foo (α : Type) :=
(a : α)
(b : α := a)
(c : α . mk_c)
def f : foo := {a := 1}
#check ({a := 1} : foo )
#check ({foo . a := 1} : foo )
#check ({..} : foo )
#check ({foo . ..} : foo )
#check {c := 1, ..f}
#check {..f}
#check {.., a := 1} -- ".." must be last item
#check {..f, a := 1} -- "..f" cannot be followed by key-value pair
structure bar :=
(a : := 0)
(b : := 0)
structure baz :=
(b : := 2)
(c : := 2)
#check ({.} : bar)
#check ({a := 1, ..{bar.}, ..{baz.}} : foo )

View file

@ -0,0 +1,22 @@
{a := 1, b := 1, c := 1} : foo
{a := 1, b := 1, c := 1} : foo
{a := ?M_1, b := ?M_1, c := 1} : foo
{a := ?M_1, b := ?M_1, c := 1} : foo
{a := f.a, b := f.b, c := 1} : foo
{a := f.a, b := f.b, c := f.c} : foo
structure_instances.lean:16:10: error: invalid expression
structure_instances.lean:16:12: error: invalid structure instance, '}' expected
structure_instances.lean:16:7: error: invalid structure notation source, not a structure
which has type
?m_1
structure_instances.lean:16:7: error: invalid structure value {...}, expected type is not known(solution: use qualified structure instance { struct_id . ... }
structure_instances.lean:16:14: error: command expected
structure_instances.lean:17:13: error: invalid structure instance, '}' expected
structure_instances.lean:17:7: error: function expected at
{a := f.a, b := f.b, c := f.c}
term has type
foo
structure_instances.lean:17:15: error: command expected
{a := 0, b := 0} : bar
{a := 1, b := {a := 0, b := 0}.b, c := {b := 2, c := 2}.c} : foo