lean4-htt/tests/elab/simple_reuse.lean
Henrik Böving a34777a08d
feat: make the borrow inference explain itself (#12810)
This PR adds tracing to the borrow inference to explain to the user why
it got to its conclusions.
2026-03-05 14:18:13 +00:00

26 lines
685 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.

/-! This test is a simple sanity check for borrow inference derived from the immutable beans
counting paper -/
/--
trace: [Compiler.inferBorrow] size: 5
def isNone._redArg @&x : UInt8 :=
cases x : UInt8
| Option.none =>
let _x.1 := 1;
return _x.1
| Option.some =>
let _x.2 := 0;
return _x.2
[Compiler.inferBorrow] own _x.23: result of function call _x.23
[Compiler.inferBorrow] size: 1
def isNone α @&x : UInt8 :=
let _x.1 := isNone._redArg x;
return _x.1
-/
#guard_msgs in
set_option trace.Compiler.inferBorrow true in
def isNone (x : Option α) : Bool :=
match x with
| some .. => false
| none => true