Open
Description
Given error positioning is only marking the end of the relevant expression. This leads to ambiguous reporting in infix expression and the error is not clear if it's the RHS argument error or the entire expression argument error.
Consider the example below. The given error positioning for x1
and x2
internal expressions are indistinguishable. Contrarily, the error positioning difference between x3
and x4
is very clear.
Compiler version
v3.5.0
Minimized code
trait Error
inline given Error = compiletime.error("my error")
def foo(using Error): Int = 0
inline def bar: Int = compiletime.error("my error")
extension (arg: Int)
def ~(arg2: Int)(using Error): Int = 0
inline def !(arg2: Int): Int = compiletime.error("my error")
val x1 = 1 + (5 + foo) + 20
val x2 = 1 + (5 ~ 200) + 20
val x3 = 1 + (5 + bar) + 20
val x4 = 1 + (5 ! 200) + 20
Output
[error] .\IDTop.scala:9:22
[error] my error
[error] val x1 = 1 + (5 + foo) + 20
[error] ^
[error] .\IDTop.scala:10:22
[error] my error
[error] val x2 = 1 + (5 ~ 200) + 20
[error] ^
[error] .\IDTop.scala:11:19
[error] my error
[error] val x3 = 1 + (5 + bar) + 20
[error] ^^^
[error] .\IDTop.scala:12:15
[error] my error
[error] val x4 = 1 + (5 ! 200) + 20
[error] ^^^^^^^
Expectation
When a given error occurs, it needs to mark the entire expression and not just the end of it, like seen in the x3
and x4
examples.