fi-0058: Reference to compiler generated payload name {:#fi-0058}

Anonymous method payloads have their names automatically generated by the FIDL compiler, so that users of generated backend code may refer to the types they represent as necessary. Referring to these types in *.fidl files themselves, however, is forbidden:

{% include “docs/reference/fidl/language/error-catalog/label/_bad.md” %}

{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/bad/fi-0058.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}

If you wish to refer to the payload type directly, you should extract the payload type into its own named type declaration instead:

{% include “docs/reference/fidl/language/error-catalog/label/_good.md” %}

{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/good/fi-0058.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}

All FIDL methods and events reserve the [PROTOCOL_NAME][METHOD_NAME]Request name for their anonymous request payloads. Strict, infallible two-way methods additionally reserve [PROTOCOL_NAME][METHOD_NAME]Response. Two-way methods that are flexible or fallible instead reserve:

  • [PROTOCOL_NAME]_[METHOD_NAME]_Result
  • [PROTOCOL_NAME]_[METHOD_NAME]_Response
  • [PROTOCOL_NAME]_[METHOD_NAME]_Error

These names use underscores unlike the others for historical reasons.