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

Trailing if on unit switch is ignored #1759

Closed
bbannier opened this issue Jun 12, 2024 · 0 comments · Fixed by #1764
Closed

Trailing if on unit switch is ignored #1759

bbannier opened this issue Jun 12, 2024 · 0 comments · Fixed by #1764
Assignees
Labels
Bug Something isn't working Diagnostics Parsing

Comments

@bbannier
Copy link
Member

We allow code with a unit switch with a trailing if, e.g.,

public type X = unit {
    switch {
        -> a: b"A";
        -> b: b"B";
        -> c: b"C";
    } if(False) ;
};

The condition is however silently ignored; for above False I would expect X to consume no data but it does

$ printf 'A' | spicy-dump -d foo.spicy
foo::X {
  a: A
}

We should either interpret such conditions correctly or reject them outright.

@bbannier bbannier added Bug Something isn't working Diagnostics Parsing labels Jun 12, 2024
@rsmmr rsmmr self-assigned this Jun 12, 2024
@rsmmr rsmmr closed this as completed in 75a78da Jun 14, 2024
rsmmr added a commit that referenced this issue Jun 14, 2024
* origin/topic/robin/gh-1759-switch-if:
  Fix `if`-condition with `switch` parsing.
  Fix clang-tidy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Diagnostics Parsing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants