[roll] Roll fuchsia [fidlc] Implement modifier change syntax
This implements the modifier change syntax from "Amendments to RFC-0232:
FIDL bindings for multiple API levels". So instead of this:
@available(replaced=5)
type Foo = strict enum {
// 100 lines ...
};
@available(added=5)
type Foo = flexible enum {
// copy & paste the 100 lines ...
};
You can now write this:
type Foo = strict(removed=5) flexible(added=5) enum {
// 100 lines ...
};
The same syntax works with `resource`, `closed`, `ajar`, and `open`.
The implementation works by treating modifiers as elements, and reusing
all the existing code for @available. I had to refactor some things
because modifier values are now not known until after AST decomposition.
This is particularly annoying for method result unions, whose existence
depends on method strictness. I decided to always create them, and
remove the framework error later on if the method is strict. Removing
the entire union proved too difficult, so I worked around that by
disallowing changing strictness on two way methods without error syntax,
which is not useful anyway because it's ABI breaking.
This change regresses the ability to define a method named "strict" or
"flexible", since supporting that with this new syntax would require
more lookahead in the parser. Once we ratify and implement explicit
method kinds (https://fxbug.dev/348403275), there will be no ambiguity
and this will be fixed.
We might want to extend the fidl-lint rule for explicit modifiers to
ensure there are no gaps when using this syntax. In the example code
above, you can omit `flexible(added=5)` since `flexible` is the default.
Currently, the linter would not complain about that because it only
operates on the raw AST, making it hard to write that kind of check.
Test: fx test fidlc-test
Test: fx check-goldens fidl
Test: fx format-code --files=(git ls-files '*.fidl' | tr '\n' ,)
Original-Fixed: 348405702 (modifier change syntax)
Original-Fixed: 42063565 (incorrect error for unnamed attribute arg)
Original-Bug: 348403275 (explicit method kinds)
Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1068250
Original-Revision: 7a91bcda60ae659615dd4191c0243bcb66b0d37c
GitOrigin-RevId: e573ed76b4cbdd8ba30548d5c775906a197c10da
Change-Id: I3d0390d19b88540d94f18e3b1611474f67f1440e
This repository contains Fuchsia's Global Integration manifest files.
All changes should be made to the internal version of this repository. Our infrastructure automatically updates this version when the internal one changes.
Currently all changes must be made by a Google employee. Non-Google employees wishing to make a change can ask for assistance via the IRC channel #fuchsia on Freenode.
First install Jiri.
Next run:
$ jiri init $ jiri import minimal https://fuchsia.googlesource.com/integration $ jiri update
Third party projects should have their own subdirectory in ./third_party.