chore: additional newline before 'additional diagnostic information' message (#7169)

This PR adds an addition newline before the "Additional diagnostic
information may be available using the `set_option ... true` command."
messages, to provide better visual separation from the main error
message.
This commit is contained in:
Kim Morrison 2025-02-24 10:27:33 +11:00 committed by GitHub
parent b863ca9ae9
commit da32bdd79c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
38 changed files with 56 additions and 4 deletions

View file

@ -46,14 +46,15 @@ register_builtin_option Elab.async : Bool := {
/--
If the `diagnostics` option is not already set, gives a message explaining this option.
Begins with a `\n`, so an error message can look like `m!"some error occurred{useDiagnosticMsg}"`.
Begins with a `\n\n`, so an error message can look like `m!"some error occurred{useDiagnosticMsg}"`.
The double newline gives better visual separation from the main error message
-/
def useDiagnosticMsg : MessageData :=
MessageData.lazy fun ctx =>
if diagnostics.get ctx.opts then
pure ""
else
pure s!"\nAdditional diagnostic information may be available using the `set_option {diagnostics.name} true` command."
pure s!"\n\nAdditional diagnostic information may be available using the `set_option {diagnostics.name} true` command."
namespace Core

View file

@ -8,4 +8,5 @@
1007.lean:39:4-39:7: warning: declaration uses 'sorry'
1007.lean:56:64-56:78: error: failed to synthesize
IsLin fun x => sum fun i => norm x
Additional diagnostic information may be available using the `set_option diagnostics true` command.

View file

@ -1,3 +1,4 @@
1102.lean:22:35-22:49: error: failed to synthesize
DVR 1
Additional diagnostic information may be available using the `set_option diagnostics true` command.

View file

@ -1,3 +1,4 @@
2273.lean:9:8-9:14: error: failed to synthesize
P 37
Additional diagnostic information may be available using the `set_option diagnostics true` command.

View file

@ -3,4 +3,5 @@
numerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is
Sort ?u
due to the absence of the instance above
Additional diagnostic information may be available using the `set_option diagnostics true` command.

View file

@ -1,3 +1,4 @@
386.lean:9:2-9:46: error: failed to synthesize
Fintype ?m
Additional diagnostic information may be available using the `set_option diagnostics true` command.

View file

@ -1,3 +1,4 @@
448.lean:21:2-23:20: error: failed to synthesize
MonadExceptOf IO.Error M
Additional diagnostic information may be available using the `set_option diagnostics true` command.

View file

@ -1,3 +1,4 @@
attrCmd.lean:6:0-6:6: error: failed to synthesize
Pure M
Additional diagnostic information may be available using the `set_option diagnostics true` command.

View file

@ -12,6 +12,7 @@ calcErrors.lean:24:8-24:11: error: invalid 'calc' step, relation expected
p a
calcErrors.lean:31:8-31:13: error: invalid 'calc' step, failed to synthesize `Trans` instance
Trans p p ?m
Additional diagnostic information may be available using the `set_option diagnostics true` command.
calcErrors.lean:41:7-41:12: error: invalid 'calc' step, left-hand side is
γ : Sort u_1

View file

@ -1,6 +1,7 @@
[4, 5, 6]
defInst.lean:8:26-8:32: error: failed to synthesize
BEq Foo
Additional diagnostic information may be available using the `set_option diagnostics true` command.
fun x y => sorry : (x y : Foo) → ?m x y
[4, 5, 6]

View file

@ -1,5 +1,6 @@
defaultInstance.lean:20:20-20:23: error: failed to synthesize
Foo Bool (?m x)
Additional diagnostic information may be available using the `set_option diagnostics true` command.
defaultInstance.lean:22:35-22:38: error: typeclass instance problem is stuck, it is often due to metavariables
Foo Bool (?m x)

View file

@ -1,6 +1,8 @@
eagerUnfoldingIssue.lean:6:2-6:17: error: failed to synthesize
MonadLog (StateM Nat)
Additional diagnostic information may be available using the `set_option diagnostics true` command.
eagerUnfoldingIssue.lean:12:2-12:17: error: failed to synthesize
MonadLog (StateM Nat)
Additional diagnostic information may be available using the `set_option diagnostics true` command.

View file

@ -1,3 +1,4 @@
eraseInsts.lean:12:22-12:27: error: failed to synthesize
HAdd Foo Foo ?m
Additional diagnostic information may be available using the `set_option diagnostics true` command.

View file

@ -1,3 +1,4 @@
forErrors.lean:3:29-3:30: error: failed to synthesize
ToStream α ?m
Additional diagnostic information may be available using the `set_option diagnostics true` command.

View file

@ -17,7 +17,7 @@
{"start": {"line": 16, "character": 12},
"end": {"line": 17, "character": 0}},
"message":
"failed to synthesize\n A\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.",
"failed to synthesize\n A\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.",
"fullRange":
{"start": {"line": 16, "character": 12},
"end": {"line": 20, "character": 0}}},
@ -37,7 +37,7 @@
{"start": {"line": 22, "character": 17},
"end": {"line": 22, "character": 20}},
"message":
"failed to synthesize\n A\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.",
"failed to synthesize\n A\n\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.",
"fullRange":
{"start": {"line": 22, "character": 17},
"end": {"line": 22, "character": 20}}},

View file

@ -1,3 +1,4 @@
kernelMVarBug.lean:5:15-5:20: error: failed to synthesize
HAdd α α α
Additional diagnostic information may be available using the `set_option diagnostics true` command.

View file

@ -11,6 +11,7 @@ while expanding
macroStack.lean:11:9-11:15: error: invalid use of `(<- ...)`, must be nested inside a 'do' expression
macroStack.lean:17:0-17:6: error: failed to synthesize
HAdd Nat String ?m
Additional diagnostic information may be available using the `set_option diagnostics true` command.
with resulting expansion
binop% HAdd.hAdd✝ (x + x✝) x✝¹

View file

@ -1,5 +1,6 @@
macroSwizzle.lean:4:7-4:23: error: failed to synthesize
HAdd Bool String ?m
Additional diagnostic information may be available using the `set_option diagnostics true` command.
macroSwizzle.lean:6:7-6:10: error: application type mismatch
Nat.succ "x"

View file

@ -1,6 +1,7 @@
openScoped.lean:1:7-1:14: error: unknown identifier 'epsilon'
openScoped.lean:4:2-4:24: error: failed to synthesize
Decidable (f = g)
Additional diagnostic information may be available using the `set_option diagnostics true` command.
Classical.epsilon.{u} {α : Sort u} [h : Nonempty α] (p : α → Prop) : α
openScoped.lean:15:7-15:14: error: unknown identifier 'epsilon'

View file

@ -4,6 +4,7 @@ prvCtor.lean:27:7-27:8: error: unknown identifier 'a'
prvCtor.lean:29:25-29:27: error: overloaded, errors
failed to synthesize
EmptyCollection (Name "hello")
Additional diagnostic information may be available using the `set_option diagnostics true` command.
invalid {...} notation, constructor for `Name` is marked as private

View file

@ -16,6 +16,7 @@ error: failed to synthesize
numerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is
Bool
due to the absence of the instance above
Additional diagnostic information may be available using the `set_option diagnostics true` command.
-/
#guard_msgs in
@ -29,6 +30,7 @@ error: failed to synthesize
numerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is
Bool
due to the absence of the instance above
Additional diagnostic information may be available using the `set_option diagnostics true` command.
-/
#guard_msgs in

View file

@ -6,6 +6,7 @@ error: failed to synthesize
numerals are polymorphic in Lean, but the numeral `1` cannot be used in a context where the expected type is
Sort _
due to the absence of the instance above
Additional diagnostic information may be available using the `set_option diagnostics true` command.
-/
#guard_msgs in
@ -17,6 +18,7 @@ error: failed to synthesize
numerals are polymorphic in Lean, but the numeral `1` cannot be used in a context where the expected type is
Sort _
due to the absence of the instance above
Additional diagnostic information may be available using the `set_option diagnostics true` command.
-/
#guard_msgs in
@ -29,6 +31,7 @@ error: failed to synthesize
numerals are polymorphic in Lean, but the numeral `1` cannot be used in a context where the expected type is
Sort _
due to the absence of the instance above
Additional diagnostic information may be available using the `set_option diagnostics true` command.
-/
#guard_msgs in

View file

@ -6,6 +6,7 @@ set_option debug.moduleNameAtTimeout false
/--
error: (deterministic) timeout, maximum number of heartbeats (100) has been reached
Use `set_option maxHeartbeats <num>` to set the limit.
Additional diagnostic information may be available using the `set_option diagnostics true` command.
-/
#guard_msgs in

View file

@ -17,6 +17,7 @@ instance instB10000 : B 10000 where
/--
error: failed to synthesize
A
Additional diagnostic information may be available using the `set_option diagnostics true` command.
-/
#guard_msgs in

View file

@ -14,6 +14,7 @@ def IsGood [DecidableEq dOut] [DecidableEq dOut₂] (Λ : Mappish dIn dOut) (Λ
/--
error: failed to synthesize
Fintype v
Additional diagnostic information may be available using the `set_option diagnostics true` command.
-/
#guard_msgs in

View file

@ -37,6 +37,7 @@ error: failed to synthesize
numerals are polymorphic in Lean, but the numeral `1` cannot be used in a context where the expected type is
String
due to the absence of the instance above
Additional diagnostic information may be available using the `set_option diagnostics true` command.
-/
#guard_msgs in
@ -48,6 +49,7 @@ error: failed to synthesize
numerals are polymorphic in Lean, but the numeral `1` cannot be used in a context where the expected type is
Bool
due to the absence of the instance above
Additional diagnostic information may be available using the `set_option diagnostics true` command.
-/
#guard_msgs in
@ -59,6 +61,7 @@ error: failed to synthesize
numerals are polymorphic in Lean, but the numeral `1` cannot be used in a context where the expected type is
Bool → Nat
due to the absence of the instance above
Additional diagnostic information may be available using the `set_option diagnostics true` command.
-/
#guard_msgs in
@ -70,6 +73,7 @@ error: failed to synthesize
numerals are polymorphic in Lean, but the numeral `0` cannot be used in a context where the expected type is
String
due to the absence of the instance above
Additional diagnostic information may be available using the `set_option diagnostics true` command.
-/
#guard_msgs in

View file

@ -13,6 +13,7 @@ example (p : Prop) : True := by
/--
error: failed to synthesize
Decidable p
Additional diagnostic information may be available using the `set_option diagnostics true` command.
-/
#guard_msgs in

View file

@ -5,6 +5,7 @@
/--
error: failed to synthesize
Coe Nat Int
Additional diagnostic information may be available using the `set_option diagnostics true` command.
-/
#guard_msgs in

View file

@ -51,6 +51,7 @@ error: failed to synthesize
numerals are polymorphic in Lean, but the numeral `22` cannot be used in a context where the expected type is
α
due to the absence of the instance above
Additional diagnostic information may be available using the `set_option diagnostics true` command.
-/
#guard_msgs(error) in

View file

@ -53,6 +53,7 @@ where
/--
error: (deterministic) timeout at `whnf`, maximum number of heartbeats (400) has been reached
Use `set_option maxHeartbeats <num>` to set the limit.
Additional diagnostic information may be available using the `set_option diagnostics true` command.
-/
#guard_msgs in

View file

@ -41,6 +41,7 @@ error: could not synthesize default value for parameter 'le' using tactics
---
error: failed to synthesize
LE NoLE
Additional diagnostic information may be available using the `set_option diagnostics true` command.
-/
#guard_msgs in

View file

@ -78,6 +78,7 @@ variable [ToString α] [ToString β]
/--
error: failed to synthesize
ToString α
Additional diagnostic information may be available using the `set_option diagnostics true` command.
-/
#guard_msgs in
@ -88,6 +89,7 @@ theorem t8 (a : α) (b : β) : True :=
/--
error: failed to synthesize
ToString β
Additional diagnostic information may be available using the `set_option diagnostics true` command.
-/
#guard_msgs in
@ -98,10 +100,12 @@ theorem t9 (a : α) (b : β) : True :=
/--
error: failed to synthesize
ToString α
Additional diagnostic information may be available using the `set_option diagnostics true` command.
---
error: failed to synthesize
ToString β
Additional diagnostic information may be available using the `set_option diagnostics true` command.
-/
#guard_msgs in

View file

@ -9,6 +9,7 @@ sanitychecks.lean:4:8-4:32: error: 'partial' theorems are not allowed, 'partial'
sanitychecks.lean:7:7-7:31: error: 'unsafe' theorems are not allowed
sanitychecks.lean:10:0-10:23: error: failed to synthesize
Inhabited False
Additional diagnostic information may be available using the `set_option diagnostics true` command.
sanitychecks.lean:18:12-18:20: error: invalid use of 'partial', 'Foo.unsound3' is not a function
False

View file

@ -1,12 +1,15 @@
scopedLocalInsts.lean:12:6-12:39: error: failed to synthesize
ToString A
Additional diagnostic information may be available using the `set_option diagnostics true` command.
"A.mk 10 20"
scopedLocalInsts.lean:21:6-21:39: error: failed to synthesize
ToString A
Additional diagnostic information may be available using the `set_option diagnostics true` command.
"{ x := 10, y := 20 }"
scopedLocalInsts.lean:32:6-32:39: error: failed to synthesize
ToString A
Additional diagnostic information may be available using the `set_option diagnostics true` command.
"A.mk 10 20"

View file

@ -7,4 +7,5 @@ term has type
Nat
semicolonOrLinebreak.lean:20:2-20:9: error: failed to synthesize
Singleton ?m Point
Additional diagnostic information may be available using the `set_option diagnostics true` command.

View file

@ -1,12 +1,14 @@
setLit.lean:22:19-22:21: error: overloaded, errors
failed to synthesize
EmptyCollection String
Additional diagnostic information may be available using the `set_option diagnostics true` command.
fields missing: 'data'
setLit.lean:24:31-24:38: error: overloaded, errors
failed to synthesize
Singleton Nat String
Additional diagnostic information may be available using the `set_option diagnostics true` command.
24:33 'val' is not a field of structure 'String'

View file

@ -2,5 +2,7 @@ tcloop.lean:14:2-14:15: error: failed to synthesize
B Nat
(deterministic) timeout at `typeclass`, maximum number of heartbeats (20000) has been reached
Use `set_option synthInstance.maxHeartbeats <num>` to set the limit.
Additional diagnostic information may be available using the `set_option diagnostics true` command.
Additional diagnostic information may be available using the `set_option diagnostics true` command.

View file

@ -1,8 +1,10 @@
typeOf.lean:11:22-11:25: error: failed to synthesize
HAdd Nat Nat Bool
Additional diagnostic information may be available using the `set_option diagnostics true` command.
typeOf.lean:12:0-12:5: error: failed to synthesize
HAdd Bool Nat Nat
Additional diagnostic information may be available using the `set_option diagnostics true` command.
typeOf.lean:20:56-20:62: error: invalid reassignment, term has type
Bool : Type