Skip to content

Trailing comma in const initialization #1383

Open
@p-offtermatt

Description

@p-offtermatt

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions