leafo / moonscript

:crescent_moon: A language that compiles to Lua

Home Page:https://moonscript.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error Reporting: Slicing without *

s-ol opened this issue · comments

commented

Using the slice syntax without the asterisk confusing error message. The minimal reproducible example is indeed very minimal:

x[,]
Compile error: [string "moonscript.lua"]:1812: Unknown chain action: slice
stack traceback:
	[C]: in function 'error'
	[string "moonscript.lua"]:1812: in local 'chain_item'
	[string "moonscript.lua"]:1827: in function 'moonscript.compile.value.chain'
	[string "moonscript.lua"]:5985: in function <[string "moonscript.lua"]:5969>
	(...tail calls...)
	[string "moonscript.lua"]:1560: in function 'moonscript.compile.statement.return'
	[string "moonscript.lua"]:6024: in method 'stm'
	[string "moonscript.lua"]:6058: in function <[string "moonscript.lua"]:6049>
	(...tail calls...)

I think this should rather lead to a parse error, and it definitely has to report the error location.