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

Cannot use unit parameters to specify a literal to parse #1859

Open
bbannier opened this issue Sep 6, 2024 · 1 comment
Open

Cannot use unit parameters to specify a literal to parse #1859

bbannier opened this issue Sep 6, 2024 · 1 comment

Comments

@bbannier
Copy link
Contributor

bbannier commented Sep 6, 2024

When parsing a field one can use e.g., const values to specify literals to expect, but using unit parameters in the same place does not resolve, e.g.,

module foo;

type X = unit {
    : Y(0);
};

type Y = unit(expected: uint8) {
    : expected;
};
$ spicyc -dj foo.spicy
[error] foo.spicy:8:5-8:15: unknown ID 'expected'
[error] spicyc: aborting after errors
@rsmmr
Copy link
Member

rsmmr commented Sep 6, 2024

The error message isn't great but it's correct to reject this: these constants/literals must be know at compile time, so parameters can't be supported.

@rsmmr rsmmr added Diagnostics and removed Parsing labels Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants