This PR gives a focused error message when a user tries to name an example, and tweaks error messages for attempts to define multiple opaque names at once. ## Example errors ``` example x : 1 == 1 := by grind ``` Current message: ``` Failed to infer type of binder `x` Note: Because this declaration's type has been explicitly provided, all parameter types and holes (e.g., `_`) in its header are resolved before its body is processed; information from the declaration body cannot be used to infer what these values should be ``` New message: ``` Failed to infer type of binder `x` Note: Examples don't have names. The identifier `x` is being interpreted as a parameter `(x : _)`. ``` ## Plural-aware identifier lists Both the example errors and opaque errors understand pluralization and use oxford commas. ``` opaque a b c : Nat ``` Current message: ``` Failed to infer type of binder `c` Note: Multiple constants cannot be declared in a single declaration. The identifier(s) `b`, `c` are being interpreted as parameters `(b : _)`, `(c : _)`. ``` New message: ``` Failed to infer type of binder `c` Note: Multiple constants cannot be declared in a single declaration. The identifiers `b` and `c` are being interpreted as parameters `(b : _)` and `(c : _)`.```
22 lines
336 B
Text
22 lines
336 B
Text
opaque a b : Nat
|
||
|
||
opaque a b c : Nat
|
||
|
||
opaque a b c d : Nat
|
||
|
||
opaque a b c d e: Nat
|
||
|
||
opaque a b (c : _) : Nat
|
||
|
||
opaque a α β : β → Bool
|
||
set_option pp.rawOnError true
|
||
|
||
example x : True := sorry
|
||
|
||
example x y : True := sorry
|
||
|
||
example x y z : True := sorry
|
||
|
||
example α β γ : β → True := sorry
|
||
|
||
example x y (c : True) : True := sorry
|