arr-ai / arrai

The ultimate data engine.
http://arr.ai
Apache License 2.0
20 stars 15 forks source link

Comment breaks tuple name inference #644

Open Allon-Guralnek opened 3 years ago

Allon-Guralnek commented 3 years ago

Please do not post any internal, closed source snippets on this public issue tracker!

Description

When creating a tuple, if there is a comment before the first element and that element uses name inference (e.g. (:x)) parsing will fail with unconsumed input. Removing the comment or specifying a name explicitly makes the parsing succeed.

This works:

let x = 42;
(
    :x   
)

Adding a comment causes it to fail with unconsumed input:

let x = 42;
(
    # hello
    :x   
)

Specifying the name explicitly makes it work again:

let x = 42;
(
    # hello
    x: x   
)

This issue doesn't happen with members who aren't first:

let x = 42;
let first = 1;
(
    :first,
    # hello
    :x   
)

Your Environment

$ arrai info
Version    : v0.214.0
Git commit : bf3504b4d161080a22048c923ce0e03f16801df3
Date       : 2021-01-05T04:23:36Z
OS/arch    : darwin/amd64
Go version : go1.15.3 darwin/amd64