You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: suggestions for ambiguous dotted identifiers (#11555)
This PR scans the environment for viable replacements for a dotted
identifier (like `.zero`) and suggests concrete alternatives as
replacements.
## Example
```
#example .zero
```
Error message:
```
Invalid dotted identifier notation: The expected type of `.cons` could not be determined
```
Additional hint added by this PR:
```
Hint: Using one of these would be unambiguous:
[apply] `BitVec.cons`
[apply] `List.cons`
[apply] `List.Lex.cons`
[apply] `List.Pairwise.cons`
[apply] `List.Perm.cons`
[apply] `List.Sublist.cons`
[apply] `List.Lex.below.cons`
[apply] `List.Pairwise.below.cons`
[apply] `List.Perm.below.cons`
[apply] `List.Sublist.below.cons`
[apply] `Lean.Grind.AC.Seq.cons`
```
## Additional changes
This PR also brings several related error message descriptions and code
actions more in line with each other, changing several "Suggested
replacement: " code actions to the more common "Change to " wording, and
sorts suggestions obtained from searching the context by the default
sort for Names (which prefers names with fewer segments).
Copy file name to clipboardExpand all lines: tests/lean/emptyTypeAscription.lean.expected.out
+20Lines changed: 20 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,25 @@
1
1
emptyTypeAscription.lean:3:19-3:24: error(lean.invalidDottedIdent): Invalid dotted identifier notation: The expected type of `.zero` could not be determined
2
+
3
+
Hint: Using one of these would be unambiguous:
4
+
[apply] `BitVec.zero`
5
+
[apply] `Dyadic.zero`
6
+
[apply] `Nat.zero`
7
+
[apply] `Vector.zero`
8
+
[apply] `Zero.zero`
9
+
[apply] `System.Uri.UriEscape.zero`
10
+
[apply] `Lean.Grind.IntModule.OfNatModule.zero`
11
+
[apply] `Lean.Grind.Linarith.Expr.zero`
2
12
emptyTypeAscription.lean:4:29-4:34: error(lean.invalidDottedIdent): Invalid dotted identifier notation: The expected type of `.zero` could not be determined
13
+
14
+
Hint: Using one of these would be unambiguous:
15
+
[apply] `BitVec.zero`
16
+
[apply] `Dyadic.zero`
17
+
[apply] `Nat.zero`
18
+
[apply] `Vector.zero`
19
+
[apply] `Zero.zero`
20
+
[apply] `System.Uri.UriEscape.zero`
21
+
[apply] `Lean.Grind.IntModule.OfNatModule.zero`
22
+
[apply] `Lean.Grind.Linarith.Expr.zero`
3
23
emptyTypeAscription.lean:9:63-9:70: error: invalid `▸` notation, expected result type of cast is
0 commit comments