This happens with any statement that goes over multiple lines. For some reason they always return the line just before the last, e.g. 7 in your case where the statement ends on 8.
Similar thing happens if you call nil values:
local var = nil
local results = var(
'test-param'
)
Errors on line 3, one before the end of the statement - not line 2 where it started or line 4 where it ended.
I don’t know if this behaviour is “wrong” as you state, or whether this is expected for statements like this.
I agree it’s not great. I just wonder if it’s a bug or if it’s intentional. If it isn’t a bug then this should definitely be a feature request. I assume an engineer will confirm either way soon.
It would definitely make more sense to be at the start, even if the problem was further in the statement it’s still better than being near the end. If it’s at the start then you’d logically look through the whole statement.
The reason the error says line 7 instead of 3 is because of the fact that you spread it out over multiple lines, so it just uses the last line of it, not including the closing brace. This doesn’t seem like incorrect behaviour, although it may seem a bit odd.
Vanilla Lua sets the line info to be the last line of the entire expression for calls and table literals. We could do this, but it doesn’t seem optimal necessarily - it seems better to reset the line number so that the report is exactly at the line where assignment is computed. However, this may make stepping through the code somewhat less convenient - not sure yet how we’ll fix this.