commit | af226dd10edba218ea1aa59bb294fad67e85c567 | [log] [tgz] |
---|---|---|
author | adonovan <adonovan@google.com> | Tue Dec 17 12:43:00 2019 -0800 |
committer | Copybara-Service <copybara-worker@google.com> | Tue Dec 17 12:44:00 2019 -0800 |
tree | 9d676c3500609bd85102cfa71e789cf25d5c2e5a | |
parent | 24a31a8ab995782a582c3a4d1790a967673e9ca1 [diff] |
bazel analysis/skylark: fix crash in attr.int(default=<function>) The type of the default=... parameter of each of the attr.<type> functions was inconsistent with the Param.type or Param.allowed_types annotations, causing the annotation-based type-check to accept a StarlarkFunction value, but the reflective call to then fail. This CL removes StarlarkFunction from Param.allowed_types for these parameters: attr.int(default=function) attr.int_list(default=function) attr.string(default=function) attr.string_list(default=function) attr.bool(default=function) attr.string_dict(default=function) attr.string_list_dict(default=function) Only these label-oriented attribute types accept a function: attr.label, attr.label_list attr.label_keyed_string_dict attr.output \ the default parameter attt.output_list / is deprecated for these CL 285849424 fixes the annotation processor to detect this and similar errors. It catches other instances and does other checks, so it is split off as a separate change. Also: - move the nasty little optionMap function out of EvalUtils (where its generic type forces it to abuse unsafe casts) and into SkylarkAttr. (The only other use, in a test, was trivially replaced by simpler code.) - use Map not Dict for the map produced by optionMap. See github.com/bazelbuild/bazel/issues/9463. PiperOrigin-RevId: 286037108
{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.
Follow our tutorials:
See CONTRIBUTING.md