lean4-htt/tests/lean/run/461a.lean
Kyle Miller e663eb1b7a
feat: structure autoParam inheritance (#7640)
This PR implements the main logic for inheriting and overriding
autoParam fields in the `structure`/`class` commands, pending being
enabled in the structure instance notation elaborator. Adds term info to
overridden fields, so they now can be hovered over, and "go to
definition" goes to the structure the field is originally defined in.

Implementation notes:
- The inherited autoParams are all recorded in the flat constructor.
Defined/overridden autoParam auxiliary tactic declarations now have
names of the form `StructName.fieldName._autoParam`
- The field `StructureFieldInfo.autoParam?` is soon to be deprecated.
The elaborator is still setting it for now, since the structure instance
notation elaborator is still using it.
2025-03-23 06:04:00 +00:00

25 lines
539 B
Text

structure FooS where
x : Nat
y : Nat
h : x = y := by rfl
/-- info: constructor FooS.mk : (x y : Nat) → autoParam (x = y) FooS.h._autoParam → FooS -/
#guard_msgs in
#print FooS.mk
def f1 (x : Nat) : FooS :=
{ x := x, y := x }
structure BooS where
x : Nat
y : Nat
h (aux1 : True) (aux2 : x > 2) : x = y := by { intros; rfl }
/--
info: constructor BooS.mk : (x y : Nat) → autoParam (True → x > 2 → x = y) BooS.h._autoParam → BooS
-/
#guard_msgs in
#print BooS.mk
def f2 (x : Nat) : BooS :=
{ x := x, y := x }