lean4-htt/tests/lean/interactive/strInterpSynthError.lean
jrr6 05948f19e4
fix: improve precision of synthesis failure spans in interpolated strings (#9004)
This PR ensures that type-class synthesis failure errors in interpolated
strings are displayed at the interpolant at which they occurred.
2025-06-27 01:47:32 +00:00

30 lines
750 B
Text

/-!
# String interpolation synthesis diagnostic spans
The spans for type-class synthesis errors in interpolated strings to be localized to the
interpolants at which synthesis failure occurs.
-/
structure Foo where
structure Bar where
def foo := Foo.mk
def bar := Bar.mk
instance : ToString Foo := ⟨fun _ => "foo"⟩
example := s!"a {foo} b {bar} c"
--^ collectDiagnostics
--^ collectDiagnostics
--^ collectDiagnostics
example := s!"{bar} a"
--^ collectDiagnostics
--^ collectDiagnostics
--^ collectDiagnostics
example := s!"a {bar}"
--^ collectDiagnostics
--^ collectDiagnostics
--^ collectDiagnostics