lean4-htt/tests/playground/badreset.lean
Leonardo de Moura cae5ee075e test(tests/playground/badreset): add test that exposes a bad reset/reuse placement
The generated code is safe, but the `reset/reuse` optimization will
never be applicable at runtime. The issue is that
`insert_reset_reuse_fn` is not checking the joint points.
I will fix the bug only at `resetreuse.lean`.
2019-05-03 17:13:29 -07:00

12 lines
415 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@[noinline] def g (x : Nat × Nat) := x
set_option trace.compiler.boxed true
@[noinline] def f (b : Bool) (x : Nat × Nat) : (Nat × Nat) × (Nat × Nat) :=
let done (y : Nat × Nat) := (g (g (g y)), x) in
match b with
| true := match x with | (a, b) := done (a, 0)
| false := match x with | (a, b) := done (0, b)
def main (xs : List String) : IO Unit :=
IO.println $ f true (xs.head.toNat, xs.tail.head.toNat)