Complete support for Starlark type annotations (#1488) This change introduces parsing, AST, formatting, and linting support for experimental Bazel Starlark type annotations (https://github.com/bazelbuild/bazel/issues/27370) and Buck2 type syntax: - Type alias statements (`type OptionalDict[T, U] = dict[T, U] | None`). - Generic `def` statements (`def foo[T, U](x: T) -> U`). - Var statements (`x: list[int]`) - `type_*` AST nodes to cleanly distinguish type syntax from standard expressions. In particular, this allows us to improve formatting for complex type applications, and to allow the ellipsis (`...`) only in type expressions. Not supported yet: `cast` and `isinstance` expressions - these will be added in a follow-up PR; supporting them is a bit tricky due to the limitations of yacc's LALR(1) grammar. Disclosure: Gemini-assisted. TAG=agy CONV=ae2ff586-d57d-4fd4-a22a-883aec5d0802 ## Buildtools PR checklist - [x] The code in this PR is covered by unit/integration tests. - [x] I have tested these changes and provide testing instructions below. - [ ] I have either responded to, or resolved all Gemini comments on the PR. - [ ] I have read Google Eng Practices on [Small Changes](https://google.github.io/eng-practices/review/developer/small-cls.html), this PR either follows these guidelines or the description provides reasoning for why they can not be followed. @brandjon @susinmotion FYI
This repository contains developer tools for working with Google's bazel buildtool.
See instructions in each tool's directory.