@@ -12,6 +12,7 @@ import dotty.tools.dotc.core.Contexts.*
12
12
import dotty .tools .dotc .core .Symbols .*
13
13
import dotty .tools .dotc .core .Types .*
14
14
import dotty .tools .dotc .core .Phases .typerPhase
15
+ import dotty .tools .dotc .reporting .BadFormatInterpolation
15
16
import dotty .tools .dotc .util .Spans .Span
16
17
import dotty .tools .dotc .util .chaining .*
17
18
@@ -276,10 +277,16 @@ class TypedFormatChecker(partsElems: List[Tree], parts: List[String], args: List
276
277
val pos = partsElems(index).sourcePos
277
278
val bgn = pos.span.start + offset
278
279
val fin = if end < 0 then pos.span.end else pos.span.start + end
279
- pos.withSpan(Span (bgn, fin, bgn))
280
+ pos.withSpan(Span (start = bgn, end = fin, point = bgn))
280
281
281
282
extension (r : report.type )
282
- def argError (message : String , index : Int ): Unit = r.error(message, args(index).srcPos).tap(_ => reported = true )
283
- def partError (message : String , index : Int , offset : Int , end : Int = - 1 ): Unit = r.error(message, partPosAt(index, offset, end)).tap(_ => reported = true )
284
- def partWarning (message : String , index : Int , offset : Int , end : Int = - 1 ): Unit = r.warning(message, partPosAt(index, offset, end)).tap(_ => reported = true )
283
+ def argError (message : String , index : Int ): Unit =
284
+ r.error(BadFormatInterpolation (message), args(index).srcPos)
285
+ .tap(_ => reported = true )
286
+ def partError (message : String , index : Int , offset : Int , end : Int = - 1 ): Unit =
287
+ r.error(BadFormatInterpolation (message), partPosAt(index, offset, end))
288
+ .tap(_ => reported = true )
289
+ def partWarning (message : String , index : Int , offset : Int , end : Int ): Unit =
290
+ r.warning(BadFormatInterpolation (message), partPosAt(index, offset, end))
291
+ .tap(_ => reported = true )
285
292
end TypedFormatChecker
0 commit comments