A declaration cannot have the same canonical name as a library import with using
:
{% include “docs/reference/fidl/language/error-catalog/label/_bad.md” %}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/bad/fi-0039-a.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/bad/fi-0039-b.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
Even though dependency
and Dependency
look different, they are both represented by the canonical name dependency
. You get the canonical name by converting the original name to snake_case
.
To fix the error, import the library under a different name with the using
... as
syntax:
{% include “docs/reference/fidl/language/error-catalog/label/_good.md” %}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/good/fi-0039-b.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
Alternatively, rename the declaration to avoid the conflict:
{% include “docs/reference/fidl/language/error-catalog/label/_good.md” %}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/good/fi-0039-c.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
See fi-0038 to learn why this error exists and how to avoid it.
See fi-0035 for more details on why FIDL requires declarations to have unique canonical names.