-
Couldn't load subscription status.
- Fork 4.3k
Description
The following pieces of syntax are to be tolerated in Bazel but ignored in the immediate future:
- Function parameter and return type annotations (
def f(x : S) -> T:) - Variable type annotations (
x : Tandx : T = value) -
typealias declaration statement (type Foo = Bar) - Generic type variables in
defandtypedeclarations (def f[S, T](x : S, Y: T):andtype Foo[T] = Bar[T]) - Ellipsis token (
Tuple[int, ...]) - Cast operator (
cast(list[str], x))
The goal is to permit Bazel 9 to be compatible with .bzls that will use type checking in later versions of Bazel.
For now, any expression is permitted as a type expression, and identifiers in type expressions are not resolved to symbols (so they do not fail when referencing an unknown symbol). In no circumstance is a type expression dynamically evaluated.
In the future when type checking is enabled, invalid type expressions will be rejected. No compatibility guarantee is made for .bzls that use type checking before the type system is non-experimental.