chore: fix some tests

Two of them are still broken due to a bug in the new elaborator.
This commit is contained in:
Leonardo de Moura 2020-05-21 09:50:20 -07:00
parent f44fe34661
commit a01552d361
5 changed files with 35 additions and 27 deletions

View file

@ -57,7 +57,7 @@ test [
"{ x // p x 10 }",
"{ x : Nat // p x 10 }",
"{ .. }",
"{ Prod . fst := 10, .. }",
"{ fst := 10, .. : Nat × Nat }",
"a[i]",
"f [10, 20]",
"g a[x+2]",

View file

@ -138,6 +138,8 @@ fun (Prod.mk x y) => f y x
(Term.structInstField `x (null) ":=" (Term.num (numLit "10")))
","
(Term.structInstField `y (null) ":=" (Term.num (numLit "20"))))
(null)
(null)
"}")
{ x := 10, y := 20, }
(Term.structInst
@ -148,6 +150,8 @@ fun (Prod.mk x y) => f y x
","
(Term.structInstField `y (null) ":=" (Term.num (numLit "20")))
",")
(null)
(null)
"}")
{ x // p x 10 }
(Term.subtype "{" `x (null) "//" (Term.app (Term.id `p (null)) (null (Term.id `x (null)) (Term.num (numLit "10")))) "}")
@ -160,12 +164,14 @@ fun (Prod.mk x y) => f y x
(Term.app (Term.id `p (null)) (null (Term.id `x (null)) (Term.num (numLit "10"))))
"}")
{ .. }
(Term.structInst "{" (null) (null (Term.structInstSource ".." (null))) "}")
{ Prod . fst := 10, .. }
(Term.structInst "{" (null) (null) (null "..") (null) "}")
{ fst := 10, .. : Nat × Nat }
(Term.structInst
"{"
(null `Prod ".")
(null (Term.structInstField `fst (null) ":=" (Term.num (numLit "10"))) "," (Term.structInstSource ".." (null)))
(null)
(null (Term.structInstField `fst (null) ":=" (Term.num (numLit "10"))) ",")
(null "..")
(null ":" (Term.prod (Term.id `Nat (null)) "×" (Term.id `Nat (null))))
"}")
a[i]
(Term.arrayRef (Term.id `a (null)) "[" (Term.id `i (null)) "]")
@ -382,7 +388,9 @@ let { fst := x, .. } := f 10; x + x
(Term.structInst
"{"
(null)
(null (Term.structInstField `fst (null) ":=" (Term.id `x (null))) "," (Term.structInstSource ".." (null)))
(null (Term.structInstField `fst (null) ":=" (Term.id `x (null))) ",")
(null "..")
(null)
"}")
(null)
(null)

View file

@ -51,31 +51,31 @@ new_frontend
namespace Ex1
#check { B . y := 1 }
#check { C . z := 1 }
#check { y := 1 : B }
#check { z := 1 : C }
end Ex1
namespace Ex2
#check { B . x := 1 }
#check { x := 1 : B }
end Ex2
namespace Ex3
#check { C . x := 1 }
#check { C . y := 1 }
#check { C . z := 1 }
#check { x := 1 : C }
#check { y := 1 : C }
#check { z := 1 : C }
end Ex3
namespace Ex4
#check { C . x := 1 } -- works
#check { C . y := 1 } -- works
#check { C . z := 1 } -- works
#check { C . z := 1, x := 2 } -- works
#check { B . y := 1 } -- works
#check { x := 1 : C } -- works
#check { y := 1 : C } -- works
#check { z := 1 : C } -- works
#check { z := 1, x := 2 : C } -- works
#check { y := 1 : B } -- works
end Ex4

View file

@ -18,10 +18,10 @@ open Ex1
def c1 : C Nat := { x := 1 }
#check { z := 2, .. c1 }
#check { c1 with z := 2 }
def c2 : C (Nat × Nat) := { z := (1, 1) }
#check { x.fst := 2, .. c2 }
#check { c2 with x.fst := 2 }
#check { x.1 := 3, .. c2 }
#check { c2 with x.1 := 3 }

View file

@ -11,17 +11,17 @@ new_frontend
#check (b).modifyOp (idx := 1) (fun s => 2)
#check { [1] := 2, .. b }
#check { b with [1] := 2 }
#check { [1].fst.2 := 1, .. a }
#check { a with [1].fst.2 := 1 }
def foo : Foo := {}
#check foo.x[1].1.2
#check { x[1].2 := true, .. foo }
#check { x[1].fst.snd := 1, .. foo }
#check { x[1].1.fst := 1, .. foo }
#check { foo with x[1].2 := true }
#check { foo with x[1].fst.snd := 1 }
#check { foo with x[1].1.fst := 1 }
#check { x[1].1.1 := 5, .. foo }
#check { x[1].1.2 := 5, .. foo }
#check { foo with x[1].1.1 := 5 }
#check { foo with x[1].1.2 := 5 }