| ## fi-0217: Invalid `@available(replaced=N)` (ABI) {:#fi-0217} |
| |
| This is like [fi-0206: Invalid `@available(replaced=N)`](#fi-0206), but for when |
| a replacement is only found matching the element's name, not its ABI: |
| |
| {% 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-0217.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %} |
| ``` |
| |
| If you intended to replace the element, make sure its ABI matches. In this case, |
| we can remove the `@selector` attribute since both methods already have the same |
| name: |
| |
| {% 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-0217-a.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %} |
| ``` |
| |
| If you did not intend to replace the ABI, use `removed` instead of `replaced`. |
| In this case, we also have to choose a different name to avoid clashing with the |
| old 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-0217-b.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %} |
| ``` |
| |
| If you really want to reuse the name but not the ABI, use `removed` instead of |
| `replaced`, and also use `renamed` to rename the old element post-removal, |
| freeing up its original name: |
| |
| {% 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-0217-c.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %} |
| ``` |
| |
| This error can occur for other members, not just methods. For bits and enum |
| members, the ABI is the integer value. For struct members, the ABI is the byte |
| offset. For table and union members, the ABI is the ordinal. |
| |
| See [FIDL versioning][fidl-versioning] to learn more about versioning. |
| |
| [fidl-versioning]: /docs/reference/fidl/language/versioning.md |