lean4-htt/tests/elabissues/anonymous_constructor_error_msg.lean
2020-02-18 10:34:24 -08:00

22 lines
558 B
Text

/-
This is an annoyingly unhelpful error message that I see all the time.
An exact line number would help a lot, but even so it would be great
to replace the `⟨...⟩` with the actual term in question.
-/
structure Foo := (n : Nat)
def Foo.sum (xs : List Foo) : Foo :=
xs.foldl (λ s x => ⟨s.n + x.n⟩) ⟨0⟩
#check
let x1 := ⟨1⟩;
let x2 := ⟨2⟩;
let x3 := ⟨3⟩;
let x4 := ⟨4⟩;
let x5 := ⟨5⟩;
let x6 := ⟨6⟩;
Foo.sum [x1, x2, x3, x5, x6]
/-
error: invalid constructor ⟨...⟩, expected type is not an inductive type
?m_1
-/