lean4-htt/tests/lean/unhygienicCode.lean
Henrik Böving 26f6bc67ee
feat: lambda pure conversion in LCNF (#12272)
This PR shifts the conversion from LCNF mono to lambda pure into the
LCNF impure phase. This is preparatory work for the upcoming refactor of
IR into LCNF impure.

The LCNF impure phase differs from the other LCNF phases in two crucial
ways:
1. I decided to have `Decl.type` be the result type as opposed to an
arrows from the parameter types to the result type. This is done because
impure does not have a notion of arrows anymore so keeping them around
for this one particular purpose would be slightly odd.
2. In order to avoid cluttering up the olean size LCNF impure saves only
the signature persistently to the disk. This is possible because we no
longer have inlining/specialization at this point of compilation so all
we need is typing information (and potentially other environment
extensions) to guide our analyses.
2026-02-03 10:24:59 +00:00

10 lines
308 B
Text

import Lean.Hygiene
open Lean
set_option trace.Compiler.extractClosed true
--set_option trace.compiler.ir.result true
-- The following function should not allocate any closures,
-- nor any heap object that doesn't appear in the result:
def foo (n : Nat) : Syntax.Term :=
Unhygienic.run `(a + $(quote n))