lean4-htt/tests/lean/run/1363.lean
Joachim Breitner c27ea08450
fix: set isRecursive only after adding the declaration (#12269)
This PR refines upon #12106, by setting the `isRecursive` env extension
after adding the declaration, but before processing attributes like
`macro_inline` that want to look at the flag. Fixes #12268.
2026-02-02 17:13:08 +00:00

53 lines
1.6 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Std.Internal.Parsec
open Std Internal Parsec String
/--
error: Cannot add `[macro_inline]` attribute to `f`: This attribute does not support this kind of declaration; only non-recursive definitions are supported
-/
#guard_msgs in
@[macro_inline] -- Error
def f : Nat → Nat
| 0 => 0
| n + 1 => f n
/--
error: Cannot add `[macro_inline]` attribute to `g`: This attribute does not support this kind of declaration; only non-recursive definitions are supported
-/
#guard_msgs in
@[macro_inline] -- Error
def g : Nat → Nat
| 0 => 0
| n + 1 => g n
termination_by x => x
/--
error: Cannot add `[macro_inline]` attribute to `h._unary`: This attribute does not support this kind of declaration; only non-recursive definitions are supported
---
error: Cannot add `[macro_inline]` attribute to `h`: This attribute does not support this kind of declaration; only non-recursive definitions are supported
-/
#guard_msgs in
@[macro_inline] -- Error
def h : Nat → Nat → Nat
| 0, _ => 0
| n + 1, m => h n m
termination_by x y => x
/--
error: Cannot add `[macro_inline]` attribute to `i`: This attribute does not support this kind of declaration; only non-recursive definitions are supported
-/
#guard_msgs in
@[macro_inline] -- Error
def i : Nat → Nat
| 0 => 0
| n + 1 => i n
partial_fixpoint
/--
error: Cannot add `[macro_inline]` attribute to `skipMany`: This attribute does not support this kind of declaration; only non-recursive definitions are supported
-/
#guard_msgs in
@[macro_inline] -- Error
partial def skipMany (p : Parser α) (it : Sigma String.Pos) : Parser PUnit := do
match p it with
| .success it _ => skipMany p it
| .error _ _ => pure ()