lean4-htt/tests/lean/run/borrowBug.lean
2020-10-25 09:16:38 -07:00

16 lines
360 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 × Nat := (x, x)
@[noinline] def p (x : Nat) : Bool := x > 10
set_option trace.compiler.ir.rc true
def f (x : Nat) (y : Nat) : Bool :=
let jp (x : Nat) : Bool := -- x must be owned
p x || p (x+1)
match x with
| 0 => let z := g y; jp z.1
| _ => let z := g x; jp z.1
def h (x : Nat) : Bool := -- x must be borrowed
x > 5