-
-
Notifications
You must be signed in to change notification settings - Fork 154
Closed
Labels
Milestone
Description
Given the following enum:
enum Counter {
Value(Number)
NoValue
}
I wrote the following code in a component:
state counter : Counter = Counter::NoValue
fun inc {
case (counter) {
Counter::Value v =>
next { counter = Counter::Value(v+1) }
Counter::NoValue =>
Promise.never()
}
}
The message I get from the compiler is:
The body of a record must end with a closing bracket.
I was looking for the bracket } but found ounter::Value(v+1) instead.
It took me a while to realize that the error came from the absence of whitespaces around the "+" token.
I think the ideal solution would be to accept "v+1" as a valid expression equivalent to "v + 1", but at least we should have a less misleading error message.