blob: 6e67c04fa4e08540cbf9cd4137e827734bc28726 [file] [view]
## fi-0086: Strict union must have non reserved member {:#fi-0086}
This error occurs when you define a strict union that is either empty, or only
has reserved members.
{% include "docs/reference/fidl/language/error-catalog/label/_bad.md" %}
```fidl
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/bad/fi-0086-a.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
```
```fidl
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/bad/fi-0086-b.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
```
To fix this error, either change the strict union to a flexible one:
{% include "docs/reference/fidl/language/error-catalog/label/_good.md" %}
```fidl
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/good/fi-0086-a.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
```
or add a non-reserved member:
```fidl
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/good/fi-0086-b.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
```
A `strict union` is one that is not evolvable in the future. Defining a strict
union with no active members implies that this is a union that contains nothing,
and should never change, which is not a useful combination of properties.
If you're trying to define something like a "unit" type, use `struct {}`
instead, since this more efficient on the wire and more idiomatic."