Inlining leads to "failed to compile definition" #5808
Labels
bug
Something isn't working
depends on new code generator
We are currently working on a new compiler (code generator) for Lean. This issue/PR is blocked by it
P-low
We are not planning to work on this issue
Prerequisites
Please put an X between the brackets as you perform the following steps:
https://github.com/leanprover/lean4/issues
Avoid dependencies to Mathlib or Batteries.
https://live.lean-lang.org/#project=lean-nightly
(You can also use the settings there to switch to “Lean nightly”)
Description
Consider the following simple definition of data
C : Type
and binary relationEqv : C → C → Type
over it.Notice that the relation introduces an equality on indices that involves a simple recursive function
id_C
.Adding the
@[inline]
annotation forid_C
results in the following error message:This is not necessarily a bug in Lean's internals if
inline
is not meant to be used on recursive functions. In that case, there should arguably be a clear message warning about the misuse ofinline
, as the current error can be quite misleading.Context
I raised this issue on a Discord server (Lean 4 anarchy); the description above summarises the issue fairly well.
Steps to Reproduce
Run the code above with
@[inline]
annotation onid_C
(i.e., uncomment the part labelled[HERE]
).Expected behavior: There should arguably be at least a clear message warning about the misuse of
inline
onid_C
.Actual behavior: User gets the following cryptic error message pointing to
id_Eqv
:Versions
[
4.12.0-nightly-2024-10-22
]Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
The text was updated successfully, but these errors were encountered: