lean4-htt/tests/lean/externBoxing.lean
Sebastian Ullrich 17e8765bdc
fix: miscompilation resulting in minor memory leak on extern projections with unboxed arguments (#11383)
This PR fixes the compilation of structure projections with unboxed
arguments marked `extern`, adding missing `dec` instructions. It led to
leaking single allocations when such functions were used as closures or
in the interpreter.

This is the minimal working fix; `extern` should not replicate parts of
the compilation pipeline, which will be possible via #10291.
2025-11-26 19:27:43 +00:00

9 lines
228 B
Text

module
/-! Applying `[extern]` to a projection should insert necessary `dec`s in `_boxed`. -/
structure Foo where
bar : UInt64 → UInt64
set_option trace.compiler.ir.result true
attribute [extern "does_not_exist"] Foo.bar