Not every FIDL layout can carry a subtype:
{% include “docs/reference/fidl/language/error-catalog/label/_bad.md” %}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/bad/fi-0031.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
Only bits
and enum
layouts are defined over an underlying type.
{% include “docs/reference/fidl/language/error-catalog/label/_good.md” %}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/good/fi-0031.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
The bits
and enum
layouts are somewhat unique, in that they are just constrained subtypings of the integral FIDL primitives. Because of this, it makes sense for them to specify an underlying type which acts as this subtype. Conversely, struct
, table
, and union
layouts can be arbitrarily large and can contain many members, therefore a global, layout-wide subtype does not make sense.