quint
quint copied to clipboard
Trailing comma in const initialization
Hi,
take this example:
module a {
const A: int
const B: int
}
module b {
import a(
A = 5,
B = 5
).*
}
Here, everything works fine. When I add this trailing comma, I get an error:
module a {
const A: int
const B: int
}
module b {
import a(
A = 5,
B = 5,
).*
}
the error is:
no viable alternative at input 'importa(A=5,B=5,)'quint(QNT000)
This is also the case in function calls (the error is different, however):
module a {
pure def f(
a: int,
b: int,
): int = a + b
}
gives me
mismatched input ')' expecting {'_', LOW_ID, CAP_ID}quint(QNT000)
However, trailing commas work fine in record definitions:
module a {
type A = {
a: string,
b: int,
}
}
I feel like the right behaviour is to allow trailing commas in all of these cases.
Makes sense to me.
I believe it is quite common for trailing commas to be disallowed inside things with parenthesis, but allowed elsewhere. I don't like this tho, we should allow it everywhere.