Avoid computing and retaining CallableTypes for untyped functions. `TypeTagger` previously constructed a `GeneralCallableType` (which meant constructing temporaries for parameter type lists and mandatoriness sets) for all `def` statements and `lambda` expressions. However, that was a waste and caused GC pressure. We need to read function types only on the following occasions: * During static type checking (`TypeChecker`), for each use of a binding in typed code. We want this to be efficient. * At eval time during dynamic type checking (experimental and disabled by default). We don't particularly care about making it efficient. * After eval, when assigning a type to exported symbols. Here, each function would typically be processed only once (unless exported in multiple struct fields, which would be unusual), so we can tolerate a small CPU overhead per function. We therefore introduce `Types.allAnyFunction()` to conveniently construct types of an functions with unannotated signatures from their rfn. We store the rfn of functions with unannotated signatures in the `TypeTable` to indicate that the symbol has been tagged, but that its type can be computed later on demand. And to avoid having the `TypeChecker` compute this type repeatedly (if an unannotated function is used in typed code), we introduce the new `TypeTable.getAndCacheType()` to cache the type. Also take the opportunity to make `TypeTable`s arrays a bit more lazy and compact. Working towards #27370 PiperOrigin-RevId: 1025872480 Change-Id: I4af6488c6f46dc64d3ca9dd89be08dbeb22f2f9c
{Fast, Correct} - Choose two
Build and test software of any size, quickly and reliably.
Speed up your builds and tests: Bazel rebuilds only what is necessary. With advanced local and distributed caching, optimized dependency analysis and parallel execution, you get fast and incremental builds.
One tool, multiple languages: Build and test Java, C++, Android, iOS, Go, and a wide variety of other language platforms. Bazel runs on Windows, macOS, and Linux.
Scalable: Bazel helps you scale your organization, codebase, and continuous integration solution. It handles codebases of any size, in multiple repositories or a huge monorepo.
Extensible to your needs: Easily add support for new languages and platforms with Bazel's familiar extension language. Share and re-use language rules written by the growing Bazel community.
To report a security issue, please email security@bazel.build with a description of the issue, the steps you took to create the issue, affected versions, and, if known, mitigations for the issue. Our vulnerability management team will respond within 3 working days of your email. If the issue is confirmed as a vulnerability, we will open a Security Advisory. This project follows a 90 day disclosure timeline.
See CONTRIBUTING.md