lean4-htt/tests/lean/run/3313.lean
Matthew Robert Ballard 7bea3c1508
chore: wrap diagnostic results in MessageData.traces (#4897)
Currently, the messages in the diagnostic summaries are created by
appending interpolated strings. We wrap these in `.trace`'s, and the
results are better formatted when expanding child nodes in the info
view. Particularly, the latter diagnostic summaries remain on their own
lines flush to the left instead of on the same line directly adjacent to
the last child node.
2024-08-06 19:10:51 +00:00

52 lines
1.8 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

class Zero (α : Type) where
zero : α
class AddCommGroup (α : Type) extends Zero α where
class Ring (α : Type) extends Zero α, AddCommGroup α
class Module (R : Type) (M : Type) [Zero R] [Zero M] where
instance (R : Type) [Zero R] : Module R R := ⟨⟩
structure Submodule (R : Type) (M : Type) [Zero R] [Zero M] [Module R M] : Type where
class HasQuotient (A : outParam <| Type) (B : Type) where
quotient' : B → Type
instance Submodule.hasQuotient {R : Type} {M : Type} [Ring R] [AddCommGroup M]
[Module R M]: HasQuotient M (Submodule R M) := ⟨fun _ => M⟩
def Synonym (M : Type) [Zero M] := M
instance Synonym.zero {G : Type} [Zero G] : Zero (Synonym G) := ⟨(Zero.zero : G)⟩
instance Synonym.addCommGroup {G : Type} [AddCommGroup G] : AddCommGroup (Synonym G) :=
{ Synonym.zero with }
instance Synonym.module (M : Type) {R : Type} [Zero R] [Zero M] [Module R M] :
Module R (Synonym M) := { }
variable (R : Type) [Ring R]
set_option maxSynthPendingDepth 2 in
/-- info: Submodule.hasQuotient -/
#guard_msgs in
#synth HasQuotient (Synonym (Synonym R)) (Submodule R (Synonym (Synonym R))) -- works
/--
info: [type_class] max synth pending failures (maxSynthPendingDepth: 1), use `set_option maxSynthPendingDepth <limit>`
[type_class] AddCommGroup Ruse `set_option diagnostics.threshold <num>` to control threshold for reporting counters
---
error: failed to synthesize
HasQuotient (Synonym (Synonym R)) (Submodule R (Synonym (Synonym R)))
-/
#guard_msgs in
set_option diagnostics true in
#synth HasQuotient (Synonym (Synonym R)) (Submodule R (Synonym (Synonym R))) -- fails
set_option maxSynthPendingDepth 2 in
/-- info: Submodule.hasQuotient -/
#guard_msgs in
#synth HasQuotient (Synonym (Synonym R)) (Submodule R (Synonym (Synonym R))) -- still works