Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vector of literals does not always check values #1860

Closed
bbannier opened this issue Sep 6, 2024 · 0 comments · Fixed by #1863
Closed

Vector of literals does not always check values #1860

bbannier opened this issue Sep 6, 2024 · 0 comments · Fixed by #1863
Assignees
Labels
Bug Something isn't working Parsing Regression

Comments

@bbannier
Copy link
Member

bbannier commented Sep 6, 2024

When parsing a vector of literals I would expect that after parsing all fields in the vector have the literal value; this is not the case.

public type X = unit {
    xs: (uint8(0))[] foreach {
        assert $$ == 0: "unreachable"
    }
};
$ printf '\x00\x01\x02' | spicy-driver -d foo.spicy
[fatal error] terminating with uncaught exception of type hilti::rt::AssertionFailure: unreachable (foo.spicy:5:9-5:38)

This regressed somewhere in #1313 which has been around since 1.7.0.

@bbannier bbannier added Bug Something isn't working Regression Parsing labels Sep 6, 2024
@rsmmr rsmmr self-assigned this Sep 9, 2024
@bbannier bbannier linked a pull request Sep 9, 2024 that will close this issue
@rsmmr rsmmr closed this as completed in f3a0290 Sep 11, 2024
rsmmr added a commit that referenced this issue Sep 11, 2024
* origin/topic/robin/gh-1860-ctor-vectors:
  Fix parsing for vectors of literals.
  Fix error message.
rsmmr added a commit that referenced this issue Sep 11, 2024
This was broken in two ways:

1. with the `(LITERAL)[]` syntax, the parser would not recognize literals
   using type constructors
2. with the syntax `LITERAL[]`, we'd try to store the parsed value
   into a vector

Closes #1860.

(cherry picked from commit f3a0290)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Parsing Regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants