lean4-htt/tests/lean/run/eta_lambda_lift.lean
Henrik Böving 3dd99fc29c
perf: eta contract instead of lambda lifting if possible (#11451)
This PR adapts the lambda lifter in LCNF to eta contract instead of
lambda lift if possible. This prevents the creation of a few hundred
unnecessary lambdas across the code base.
2025-12-02 08:39:24 +00:00

17 lines
442 B
Text

import Lean.Util.FindExpr
/-!
This test asserts that the compiler will eta contract trivial lambdas instead of lambda lifting
them.
-/
/--
trace: [Compiler.lambdaLifting] size: 2
def test e : Option Lean.Expr :=
let _f.1 := Lean.Expr.hasMVar;
let _x.2 := Lean.Expr.findImpl? _f.1 e;
return _x.2
-/
#guard_msgs in
set_option trace.Compiler.lambdaLifting true in
def test (e : Lean.Expr) := e.find? (fun e => e.hasMVar)