diff --git a/src/Lean/Elab/MutualDef.lean b/src/Lean/Elab/MutualDef.lean index 70d4be084a..9864e4dc4e 100644 --- a/src/Lean/Elab/MutualDef.lean +++ b/src/Lean/Elab/MutualDef.lean @@ -729,8 +729,8 @@ where let headers ← levelMVarToParamHeaders views headers let allUserLevelNames := getAllUserLevelNames headers withFunLocalDecls headers fun funFVars => do - for header in headers, funFVar in funFVars do - addTermInfo (isBinder := true) header.ref funFVar + for view in views, funFVar in funFVars do + addTermInfo (isBinder := true) view.declId funFVar let values ← elabFunValues headers Term.synthesizeSyntheticMVarsNoPostponing let values ← values.mapM (instantiateMVars ·) diff --git a/tests/lean/1018unknowMVarIssue.lean.expected.out b/tests/lean/1018unknowMVarIssue.lean.expected.out index 2f8a81f64a..f3ee58db46 100644 --- a/tests/lean/1018unknowMVarIssue.lean.expected.out +++ b/tests/lean/1018unknowMVarIssue.lean.expected.out @@ -22,7 +22,7 @@ a : α x (isBinder := true) : Fam2 α β @ ⟨7, 17⟩-⟨7, 18⟩ β : Type @ ⟨7, 33⟩-⟨7, 34⟩ @ Lean.Elab.Term.elabIdent β : Type @ ⟨7, 33⟩-⟨7, 34⟩ - _example (isBinder := true) : {α β : Type} → α → Fam2 α β → β @ ⟨7, 0⟩-⟨10, 19⟩ + _example (isBinder := true) : {α β : Type} → α → Fam2 α β → β @ ⟨7, 0⟩†-⟨10, 19⟩† a (isBinder := true) : α @ ⟨7, 9⟩-⟨7, 10⟩ x (isBinder := true) : Fam2 α β @ ⟨7, 17⟩-⟨7, 18⟩ _example.match_1 (fun α β x a => β) α β x a (fun α_1 a => ?m x α_1 a) fun n a => diff --git a/tests/lean/infoTree.lean.expected.out b/tests/lean/infoTree.lean.expected.out index 236d54f525..720d4a9cf3 100644 --- a/tests/lean/infoTree.lean.expected.out +++ b/tests/lean/infoTree.lean.expected.out @@ -16,7 +16,7 @@ Nat : Type @ ⟨13, 24⟩-⟨13, 27⟩ @ Lean.Elab.Term.elabIdent [.] `Nat : some Type.{?_uniq.425} @ ⟨13, 24⟩-⟨13, 27⟩ Nat : Type @ ⟨13, 24⟩-⟨13, 27⟩ - f (isBinder := true) : Nat → Nat × Nat @ ⟨13, 0⟩-⟨15, 6⟩ + f (isBinder := true) : Nat → Nat × Nat @ ⟨13, 4⟩-⟨13, 5⟩ x (isBinder := true) : Nat @ ⟨13, 7⟩-⟨13, 8⟩ let y := (x, x); id y : Nat × Nat @ ⟨14, 2⟩-⟨15, 6⟩ @ Lean.Elab.Term.elabLetDecl @@ -71,7 +71,7 @@ 0 : Nat @ ⟨17, 39⟩-⟨17, 40⟩ @ Lean.Elab.Term.elabNumLit x : Nat @ ⟨17, 43⟩-⟨17, 44⟩ @ Lean.Elab.Term.elabIdent x : Nat @ ⟨17, 43⟩-⟨17, 44⟩ - h (isBinder := true) : ∀ (x y : Nat), Bool → x + 0 = x @ ⟨17, 0⟩-⟨19, 8⟩ + h (isBinder := true) : ∀ (x y : Nat), Bool → x + 0 = x @ ⟨17, 4⟩-⟨17, 5⟩ fun x y b => of_eq_true (Eq.trans (congrFun (congrArg Eq (Nat.add_zero x)) x) @@ -129,7 +129,7 @@ Nat : Type @ ⟨21, 36⟩-⟨21, 39⟩ @ Lean.Elab.Term.elabIdent [.] `Nat : some Sort.{?_uniq.586} @ ⟨21, 36⟩-⟨21, 39⟩ Nat : Type @ ⟨21, 36⟩-⟨21, 39⟩ - f2 (isBinder := true) : Nat → Nat → Bool → Nat @ ⟨21, 0⟩-⟨25, 10⟩ + f2 (isBinder := true) : Nat → Nat → Bool → Nat @ ⟨21, 4⟩-⟨21, 6⟩ fun x y b => let _discr := (x + y, x - y); match (x + y, x - y) with @@ -278,7 +278,7 @@ Nat : Type @ ⟨27, 45⟩-⟨27, 48⟩ @ Lean.Elab.Term.elabIdent [.] `Nat : some Type.{?_uniq.802} @ ⟨27, 45⟩-⟨27, 48⟩ Nat : Type @ ⟨27, 45⟩-⟨27, 48⟩ - f3 (isBinder := true) : Nat × Array (Array Nat) → Array Nat @ ⟨27, 0⟩-⟨28, 17⟩ + f3 (isBinder := true) : Nat × Array (Array Nat) → Array Nat @ ⟨27, 4⟩-⟨27, 6⟩ s (isBinder := true) : Nat × Array (Array Nat) @ ⟨27, 8⟩-⟨27, 9⟩ Array.push (Array.getOp s.snd 1) s.fst : Array Nat @ ⟨28, 2⟩-⟨28, 17⟩ @ Lean.Elab.Term.elabApp s : Nat × Array (Array Nat) @ ⟨28, 2⟩-⟨28, 3⟩ @@ -299,7 +299,7 @@ Nat : Type @ ⟨30, 19⟩-⟨30, 22⟩ @ Lean.Elab.Term.elabIdent [.] `Nat : some Sort.{?_uniq.846} @ ⟨30, 19⟩-⟨30, 22⟩ Nat : Type @ ⟨30, 19⟩-⟨30, 22⟩ - f4 (isBinder := true) : B → Nat @ ⟨30, 0⟩-⟨31, 20⟩ + f4 (isBinder := true) : B → Nat @ ⟨30, 4⟩-⟨30, 6⟩ arg (isBinder := true) : B @ ⟨30, 8⟩-⟨30, 11⟩ A.val arg.pair.fst 0 : Nat @ ⟨31, 2⟩-⟨31, 20⟩ @ Lean.Elab.Term.elabApp arg : B @ ⟨31, 2⟩-⟨31, 5⟩ @@ -319,7 +319,7 @@ B : Type @ ⟨33, 19⟩-⟨33, 20⟩ @ Lean.Elab.Term.elabIdent [.] `B : some Sort.{?_uniq.869} @ ⟨33, 19⟩-⟨33, 20⟩ B : Type @ ⟨33, 19⟩-⟨33, 20⟩ - f5 (isBinder := true) : Nat → B @ ⟨33, 0⟩-⟨35, 1⟩ + f5 (isBinder := true) : Nat → B @ ⟨33, 4⟩-⟨33, 6⟩ x (isBinder := true) : Nat @ ⟨33, 8⟩-⟨33, 9⟩ { pair := ({ val := id }, { val := id }) } : B @ ⟨33, 24⟩-⟨35, 1⟩ @ Lean.Elab.Term.StructInst.elabStructInst ({ val := id }, { val := id }) : A × A @ ⟨34, 10⟩-⟨34, 40⟩ @ Lean.Elab.Term.expandParen @@ -375,7 +375,7 @@ infoTree.lean:44:0: error: expected stx _uniq.892 : Nat @ ⟨45, 21⟩-⟨45, 22⟩ _uniq.892 : Nat @ ⟨45, 25⟩-⟨45, 26⟩ @ Lean.Elab.Term.elabIdent _uniq.892 : Nat @ ⟨45, 25⟩-⟨45, 26⟩ - _uniq.898 (isBinder := true) : forall (x : Nat), Nat -> (Eq.{1} Nat x x) @ ⟨45, 0⟩-⟨47, 8⟩ + _uniq.898 (isBinder := true) : forall (x : Nat), Nat -> (Eq.{1} Nat x x) @ ⟨45, 4⟩-⟨45, 6⟩ _uniq.901 (isBinder := true) : Nat @ ⟨45, 8⟩-⟨45, 9⟩ _uniq.902 (isBinder := true) : Nat @ ⟨45, 10⟩-⟨45, 11⟩ (fun (f7 : forall (x : Nat), Nat -> (Eq.{1} Nat x x)) => [mdata _recApp: f7 _uniq.901 _uniq.902]) f6.f7 : Eq.{1} Nat _uniq.901 _uniq.901 @ ⟨46, 2⟩-⟨47, 8⟩ @ Lean.Elab.Term.elabLetRec @@ -421,7 +421,7 @@ infoTree.lean:44:0: error: expected stx B : Type @ ⟨50, 17⟩-⟨50, 18⟩ @ Lean.Elab.Term.elabIdent [.] `B : some Sort.{?_uniq.941} @ ⟨50, 17⟩-⟨50, 18⟩ B : Type @ ⟨50, 17⟩-⟨50, 18⟩ - _uniq.942 (isBinder := true) : B -> B @ ⟨50, 0⟩-⟨50, 32⟩ + _uniq.942 (isBinder := true) : B -> B @ ⟨50, 4⟩-⟨50, 6⟩ _uniq.944 (isBinder := true) : B @ ⟨50, 8⟩-⟨50, 9⟩ B.mk (B.pair _uniq.944) : B @ ⟨50, 22⟩-⟨50, 32⟩ @ Lean.Elab.Term.StructInst.elabStructInst B.pair _uniq.944 : Prod.{0 0} A A @ ⟨50, 24⟩-⟨50, 25⟩† @ Lean.Elab.Term.elabProj diff --git a/tests/lean/interactive/highlight.lean.expected.out b/tests/lean/interactive/highlight.lean.expected.out index 6f8c649a7b..859c77de75 100644 --- a/tests/lean/interactive/highlight.lean.expected.out +++ b/tests/lean/interactive/highlight.lean.expected.out @@ -22,9 +22,6 @@ {"range": {"start": {"line": 22, "character": 16}, "end": {"line": 22, "character": 19}}, - "kind": 1}, - {"range": - {"start": {"line": 1, "character": 0}, "end": {"line": 1, "character": 30}}, "kind": 1}] {"textDocument": {"uri": "file://highlight.lean"}, "position": {"line": 5, "character": 7}} @@ -40,9 +37,6 @@ {"textDocument": {"uri": "file://highlight.lean"}, "position": {"line": 10, "character": 3}} [{"range": - {"start": {"line": 8, "character": 0}, "end": {"line": 10, "character": 9}}, - "kind": 1}, - {"range": {"start": {"line": 9, "character": 6}, "end": {"line": 9, "character": 9}}, "kind": 1}, {"range": @@ -67,9 +61,6 @@ "kind": 1}, {"range": {"start": {"line": 23, "character": 4}, "end": {"line": 23, "character": 7}}, - "kind": 1}, - {"range": - {"start": {"line": 18, "character": 0}, "end": {"line": 19, "character": 9}}, "kind": 1}] {"textDocument": {"uri": "file://highlight.lean"}, "position": {"line": 23, "character": 5}} @@ -81,9 +72,6 @@ "kind": 1}, {"range": {"start": {"line": 23, "character": 4}, "end": {"line": 23, "character": 7}}, - "kind": 1}, - {"range": - {"start": {"line": 22, "character": 0}, "end": {"line": 23, "character": 29}}, "kind": 1}] {"textDocument": {"uri": "file://highlight.lean"}, "position": {"line": 23, "character": 12}} @@ -98,7 +86,4 @@ {"range": {"start": {"line": 23, "character": 24}, "end": {"line": 23, "character": 27}}, - "kind": 1}, - {"range": - {"start": {"line": 22, "character": 0}, "end": {"line": 23, "character": 29}}, "kind": 1}] diff --git a/tests/lean/interactive/hover.lean.expected.out b/tests/lean/interactive/hover.lean.expected.out index a075924e32..bffd202095 100644 --- a/tests/lean/interactive/hover.lean.expected.out +++ b/tests/lean/interactive/hover.lean.expected.out @@ -102,7 +102,7 @@ null {"range": {"start": {"line": 112, "character": 9}, "end": {"line": 112, "character": 12}}, - "contents": {"value": "```lean\nBar.foo : Nat\n```", "kind": "markdown"}} + "contents": {"value": "```lean\nfoo : Nat\n```", "kind": "markdown"}} {"textDocument": {"uri": "file://hover.lean"}, "position": {"line": 115, "character": 9}} {"range": @@ -113,7 +113,7 @@ null "position": {"line": 118, "character": 4}} {"range": {"start": {"line": 118, "character": 4}, "end": {"line": 118, "character": 7}}, - "contents": {"value": "```lean\nBar.bar : Nat\n```", "kind": "markdown"}} + "contents": {"value": "```lean\nbar : Nat\n```", "kind": "markdown"}} {"textDocument": {"uri": "file://hover.lean"}, "position": {"line": 121, "character": 10}} {"range": @@ -156,8 +156,7 @@ null {"range": {"start": {"line": 134, "character": 9}, "end": {"line": 134, "character": 10}}, - "contents": - {"value": "```lean\nBar.f : ToString Nat\n```", "kind": "markdown"}} + "contents": {"value": "```lean\nf : ToString Nat\n```", "kind": "markdown"}} {"textDocument": {"uri": "file://hover.lean"}, "position": {"line": 137, "character": 10}} {"range": @@ -171,13 +170,13 @@ null {"range": {"start": {"line": 140, "character": 4}, "end": {"line": 140, "character": 11}}, - "contents": {"value": "```lean\nBar.foo.bar : Nat\n```", "kind": "markdown"}} + "contents": {"value": "```lean\nbar : Nat\n```", "kind": "markdown"}} {"textDocument": {"uri": "file://hover.lean"}, "position": {"line": 140, "character": 8}} {"range": {"start": {"line": 140, "character": 4}, "end": {"line": 140, "character": 11}}, - "contents": {"value": "```lean\nBar.foo.bar : Nat\n```", "kind": "markdown"}} + "contents": {"value": "```lean\nbar : Nat\n```", "kind": "markdown"}} {"textDocument": {"uri": "file://hover.lean"}, "position": {"line": 145, "character": 6}} {"range": diff --git a/tests/lean/interactive/jumpMutual.lean b/tests/lean/interactive/jumpMutual.lean index eecd877f99..141f9a7060 100644 --- a/tests/lean/interactive/jumpMutual.lean +++ b/tests/lean/interactive/jumpMutual.lean @@ -3,8 +3,9 @@ mutual def h (x : Nat) : Nat := match x with | 0 => 1 + --v textDocument/definition --v textDocument/definition - | x+1 => f x + r x + | x+1 => f x + r x + h x --^ textDocument/definition where r : Nat → Nat diff --git a/tests/lean/interactive/jumpMutual.lean.expected.out b/tests/lean/interactive/jumpMutual.lean.expected.out index a9eb3ae492..79da0eaabb 100644 --- a/tests/lean/interactive/jumpMutual.lean.expected.out +++ b/tests/lean/interactive/jumpMutual.lean.expected.out @@ -1,70 +1,73 @@ {"textDocument": {"uri": "file://jumpMutual.lean"}, - "position": {"line": 6, "character": 17}} + "position": {"line": 6, "character": 23}} +[] +{"textDocument": {"uri": "file://jumpMutual.lean"}, + "position": {"line": 7, "character": 17}} [{"targetUri": "file://jumpMutual.lean", "targetSelectionRange": - {"start": {"line": 9, "character": 2}, "end": {"line": 9, "character": 3}}, + {"start": {"line": 10, "character": 2}, "end": {"line": 10, "character": 3}}, "targetRange": - {"start": {"line": 9, "character": 2}, "end": {"line": 9, "character": 3}}, + {"start": {"line": 10, "character": 2}, "end": {"line": 10, "character": 3}}, "originSelectionRange": - {"start": {"line": 6, "character": 17}, "end": {"line": 6, "character": 18}}}] + {"start": {"line": 7, "character": 17}, "end": {"line": 7, "character": 18}}}] {"textDocument": {"uri": "file://jumpMutual.lean"}, - "position": {"line": 6, "character": 11}} + "position": {"line": 7, "character": 11}} [{"targetUri": "file://jumpMutual.lean", "targetSelectionRange": - {"start": {"line": 15, "character": 0}, "end": {"line": 21, "character": 11}}, + {"start": {"line": 16, "character": 4}, "end": {"line": 16, "character": 5}}, "targetRange": - {"start": {"line": 15, "character": 0}, "end": {"line": 21, "character": 11}}, + {"start": {"line": 16, "character": 4}, "end": {"line": 16, "character": 5}}, "originSelectionRange": - {"start": {"line": 6, "character": 11}, "end": {"line": 6, "character": 12}}}] + {"start": {"line": 7, "character": 11}, "end": {"line": 7, "character": 12}}}] {"textDocument": {"uri": "file://jumpMutual.lean"}, - "position": {"line": 12, "character": 13}} + "position": {"line": 13, "character": 13}} [{"targetUri": "file://jumpMutual.lean", "targetSelectionRange": - {"start": {"line": 9, "character": 2}, "end": {"line": 9, "character": 3}}, + {"start": {"line": 10, "character": 2}, "end": {"line": 10, "character": 3}}, "targetRange": - {"start": {"line": 9, "character": 2}, "end": {"line": 9, "character": 3}}, + {"start": {"line": 10, "character": 2}, "end": {"line": 10, "character": 3}}, "originSelectionRange": - {"start": {"line": 12, "character": 13}, - "end": {"line": 12, "character": 14}}}] + {"start": {"line": 13, "character": 13}, + "end": {"line": 13, "character": 14}}}] {"textDocument": {"uri": "file://jumpMutual.lean"}, - "position": {"line": 12, "character": 19}} + "position": {"line": 13, "character": 19}} [{"targetUri": "file://jumpMutual.lean", "targetSelectionRange": - {"start": {"line": 2, "character": 0}, "end": {"line": 12, "character": 22}}, + {"start": {"line": 2, "character": 4}, "end": {"line": 2, "character": 5}}, "targetRange": - {"start": {"line": 2, "character": 0}, "end": {"line": 12, "character": 22}}, + {"start": {"line": 2, "character": 4}, "end": {"line": 2, "character": 5}}, "originSelectionRange": - {"start": {"line": 12, "character": 19}, - "end": {"line": 12, "character": 20}}}] + {"start": {"line": 13, "character": 19}, + "end": {"line": 13, "character": 20}}}] {"textDocument": {"uri": "file://jumpMutual.lean"}, - "position": {"line": 19, "character": 17}} + "position": {"line": 20, "character": 17}} [{"targetUri": "file://jumpMutual.lean", "targetSelectionRange": - {"start": {"line": 16, "character": 10}, - "end": {"line": 16, "character": 11}}, + {"start": {"line": 17, "character": 10}, + "end": {"line": 17, "character": 11}}, "targetRange": - {"start": {"line": 16, "character": 10}, - "end": {"line": 16, "character": 11}}, + {"start": {"line": 17, "character": 10}, + "end": {"line": 17, "character": 11}}, "originSelectionRange": - {"start": {"line": 19, "character": 17}, - "end": {"line": 19, "character": 18}}}] + {"start": {"line": 20, "character": 17}, + "end": {"line": 20, "character": 18}}}] {"textDocument": {"uri": "file://jumpMutual.lean"}, - "position": {"line": 21, "character": 2}} + "position": {"line": 22, "character": 2}} [{"targetUri": "file://jumpMutual.lean", "targetSelectionRange": - {"start": {"line": 16, "character": 10}, - "end": {"line": 16, "character": 11}}, + {"start": {"line": 17, "character": 10}, + "end": {"line": 17, "character": 11}}, "targetRange": - {"start": {"line": 16, "character": 10}, - "end": {"line": 16, "character": 11}}, + {"start": {"line": 17, "character": 10}, + "end": {"line": 17, "character": 11}}, "originSelectionRange": - {"start": {"line": 21, "character": 2}, "end": {"line": 21, "character": 3}}}] + {"start": {"line": 22, "character": 2}, "end": {"line": 22, "character": 3}}}] {"textDocument": {"uri": "file://jumpMutual.lean"}, - "position": {"line": 21, "character": 8}} + "position": {"line": 22, "character": 8}} [{"targetUri": "file://jumpMutual.lean", "targetSelectionRange": - {"start": {"line": 2, "character": 0}, "end": {"line": 12, "character": 22}}, + {"start": {"line": 2, "character": 4}, "end": {"line": 2, "character": 5}}, "targetRange": - {"start": {"line": 2, "character": 0}, "end": {"line": 12, "character": 22}}, + {"start": {"line": 2, "character": 4}, "end": {"line": 2, "character": 5}}, "originSelectionRange": - {"start": {"line": 21, "character": 8}, "end": {"line": 21, "character": 9}}}] + {"start": {"line": 22, "character": 8}, "end": {"line": 22, "character": 9}}}]