-
Notifications
You must be signed in to change notification settings - Fork 463
Open
Description
I don't think this is actually very important, but it was a source of confusion at some point so here it is.
It's quite easy to write something like:
{x: {y: 1}} {x:+ { z: 2 }}
It doesn't work and error message is mildly confusing:
RUNTIME ERROR: Unary operator + does not operate on type object
It's worse on integer types (that I initially got a problem with), but I suppose this is not what +:
was designed for anyway:
{x: 1} { x :+ 42}
It doesn't fail, but the result is not what I expected:
{
"x": 42
}
I think it can be easily made better by lexing :+
as a single token. Then a much more friendly static error would appear:
Expected one of :, ::, :::, +:, +::, +:::, got: :+
seh and afgiel