This PR fixes a `(kernel) declaration has metavariables` error that occurred when a `by` tactic was used in a dependent inductive type index that refers to a previous index: ```lean axiom P : Prop axiom Q : P → Prop -- Previously gave: (kernel) declaration has metavariables 'Foo' inductive Foo : (h : P) → (Q (by exact h)) → Prop ``` The root cause: `elabDepArrow` calls `mkForallFVars [h_fvar] body` before the `by` tactic's metavariable `?m` is resolved. Since `h_fvar` is in `?m`'s local context, `elimMVarDeps` creates a delayed assignment `?newMVar #[h_fvar] := ?m`. After `synthesizeSyntheticMVarsNoPostponing` assigns `?m := h_fvar`, `instantiateMVars` can resolve the delayed assignment (substituting `h_fvar` with the actual argument, `bvar 0`, in the pending value), yielding the correct type `∀ (h : P), Q (bvar 0) → Prop`. The fix is to call `instantiateMVars` on the header type right after `synthesizeSyntheticMVarsNoPostponing` in `elabHeadersAux`. Fixes #12543. 🤖 This PR was created with [Claude Code](https://claude.ai/claude-code). Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
12 lines
414 B
Text
12 lines
414 B
Text
-- Test for issue #12543: `(kernel) declaration has metavariables` when
|
|
-- an inductive type index refers to a previous index via `by`.
|
|
|
|
axiom P : Prop
|
|
axiom Q : P → Prop
|
|
|
|
-- Previously gave: (kernel) declaration has metavariables 'Foo'
|
|
inductive Foo : (h : P) → (Q (by exact h)) → Prop
|
|
|
|
-- These always worked:
|
|
inductive Foo' : (h : P) → (Q h) → Prop
|
|
inductive Foo'' (h : P) : (Q (by exact h)) → Prop
|