This PR sets up the new integrated test/bench suite. It then migrates all benchmarks and some related tests to the new suite. There's also some documentation and some linting. For now, a lot of the old tests are left alone so this PR doesn't become even larger than it already is. Eventually, all tests should be migrated to the new suite though so there isn't a confusing mix of two systems.
42 lines
881 B
Text
42 lines
881 B
Text
set_option trace.compiler.ir.result true
|
|
|
|
-- All generated case and ctor instructions should use the _impl version
|
|
|
|
inductive Exp
|
|
| var (i : UInt32)
|
|
| app (a b : Exp)
|
|
| a1
|
|
| a2
|
|
| a3
|
|
| a4
|
|
| a5
|
|
with
|
|
@[computed_field] hash : Exp → UInt64
|
|
| .var i => Hashable.hash i + 1000
|
|
| .app a b => mixHash (hash a) (hash b)
|
|
| _ => 42
|
|
|
|
def f := Exp.hash (.app (.var 10) .a4)
|
|
|
|
-- should use 'default →' case
|
|
def g : Exp → Bool
|
|
| .a3 => true
|
|
| _ => false
|
|
|
|
-- using the same matcher as in the computed field should work
|
|
def hash' : Exp → Nat
|
|
| .var i => i.toNat
|
|
| .app a b => hash' a + hash' b
|
|
| _ => 42
|
|
|
|
-- should not invoke Exp.var._override
|
|
def getAppFn : Exp → Exp
|
|
| .app f _ => getAppFn f
|
|
| e => e
|
|
|
|
-- should not call Exp.app._override
|
|
def Exp.f (e : Exp) : Exp :=
|
|
match app e e with
|
|
| var _ => e
|
|
| app a _ => getAppFn a
|
|
| e => e
|