previously, only the WellFounded code was making use of the error location in the RecApp-metadata. We can do the same for structural recursion. This way, ``` def f (n : Nat) : Nat := match n with | 0 => 0 | n + 1 => f (n + 1) ``` will show the error with squiggly lines under `f (n + 1)`, and not at `def f`.
14 lines
430 B
Text
14 lines
430 B
Text
wf1.lean:3:12-3:19: error: fail to show termination for
|
|
g
|
|
with errors
|
|
argument #1 was not used for structural recursion
|
|
failed to eliminate recursive application
|
|
g (x - 1)
|
|
|
|
argument #2 was not used for structural recursion
|
|
insufficient number of parameters at recursive application
|
|
g (x - 1)
|
|
|
|
structural recursion cannot be used
|
|
|
|
failed to prove termination, use `termination_by` to specify a well-founded relation
|