Unexpected behavior for multiple `to` statements
Metadata
Current evaluation
No evaluation has been recorded for this issue yet.
Issue body
Given the following:
```yaml
parts:
my-part:
build-packages:
- to armhf:
- foo
- to riscv64:
- bar
- else:
- baz
```
Building for armhf will evaluate to `["foo", "baz"]` and building for riscv64 will evaluate to `["bar"]`.
This is an unexpected UX and there are no warnings or errors to explain the behavior. Either craft-grammar should error when given multiple `to` statements with an `else` or it should properly handle this scenario.
A reproducer in the unit test suite can be seen here: https://github.com/canonical/craft-grammar/commit/12c031a207eaec4e1c345ad8a9ad2444ec4429ae
Source: https://github.com/canonical/snapcraft/issues/5255
Evaluation history
No evaluation history available.