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

Missing warning on ignored parsing attributes on type alias #1861

Open
bbannier opened this issue Sep 6, 2024 · 0 comments
Open

Missing warning on ignored parsing attributes on type alias #1861

bbannier opened this issue Sep 6, 2024 · 0 comments

Comments

@bbannier
Copy link
Contributor

bbannier commented Sep 6, 2024

The parser currently accepts parsing attributes on type alias declarations, e.g., this alias is accepted:

type Addr = addr &ipv4;

Using this alias triggers an error though:

type X = unit {
    : Addr; # ERROR: address field must come with either &ipv4 or &ipv6 attribute
};

This is due to us accepting the attribute on the alias, but ignoring it (correctly since here &ipv4 is not an proper attribute for a type, but only a field). In this case this is just confusing, but could make it to silently introduce bugs if attributes like e.g., &requires or &max-size. See e.g., #1845 (comment) where this cause confused a user.

I feel we should outright reject such attributes with a diagnostic.

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

1 participant