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
Copy file name to clipboardExpand all lines: src/Lean/ErrorExplanations/InvalidField.lean
+26-6Lines changed: 26 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,9 @@ and be a calling a function on the value `color` with
27
27
#eval (4 + 2).suc
28
28
```
29
29
```output
30
-
Invalid field `suc`: The environment does not contain `Nat.suc`, so it is not possible to project the field `suc` from an expression `4 + 2` of type `Nat`
30
+
Invalid field `suc`: The environment does not contain `Nat.suc`, so it is not possible to project the field `suc` from an expression
31
+
4 + 2
32
+
of type `Nat`
31
33
```
32
34
```lean fixed
33
35
#eval (4 + 1).succ
@@ -41,7 +43,9 @@ The simplest reason fo
41
43
#eval '>'.leftpad 10 ['a', 'b', 'c']
42
44
```
43
45
```output
44
-
Invalid field `leftpad`: The environment does not contain `Char.leftpad`, so it is not possible to project the field `leftpad` from an expression `'>'` of type `Char`
46
+
Invalid field `leftpad`: The environment does not contain `Char.leftpad`, so it is not possible to project the field `leftpad` from an expression
47
+
'>'
48
+
of type `Char`
45
49
```
46
50
```lean fixed
47
51
#eval ['a', 'b', 'c'].leftpad 10 '>'
@@ -51,17 +55,16 @@ The type of the expression before the dot determines the function being called b
51
55
the dot. There is no `Char.leftpad`, and the only way to invoke `List.leftpad` with generalized
52
56
field notation is to have the list come before the dot.
53
57
54
-
## Insufficient Type Information
58
+
## Type is Not Specific
55
59
56
60
```lean broken
57
61
def double_plus_one {α} [Add α] (x : α) :=
58
62
(x + x).succ
59
63
```
60
64
```output
61
-
Invalid field notation: Type is not of the form `C ...` where C is a constant
65
+
Invalid field notation: Field projection operates on types of the form `C ...` where C is a constant. The expression
62
66
x + x
63
-
has type
64
-
α
67
+
has type `α` which does not have the necessary form.
0 commit comments