Skip to content

trotta/fix allow empty container s types to be lazily resolved - #442

Closed
Ahajha wants to merge 8 commits into
withered-magic:mainfrom
Ahajha:trotta/fix-allow-empty-container-s-types-to-be-lazily-resolved
Closed

Ahajha wants to merge 8 commits into
withered-magic:mainfrom
Ahajha:trotta/fix-allow-empty-container-s-types-to-be-lazily-resolved

Conversation

@Ahajha

@Ahajha Ahajha commented Oct 1, 2026

Copy link
Copy Markdown
  • Use prebuilt protoc
  • Gate remote caching flags on whether the API key exists
  • Fix: Enable bzlmod by default for Bazel 7 onwards
  • chore: Bump rules_rust and rust version
  • chore: add label_list_dict
  • fix: Correctly resolve labels with a slash in the target name
  • Fix escape sequences in triple quotes not resetting the closing streak
  • fix: allow empty container's types to be lazily resolved

Ahajha added 8 commits July 9, 2026 01:36
This speeds up cold builds a bit by not requiring protoc to be built from source.
Right now we have a hardcoded list of versions that needs to be updated, currently Bazel 10 prerelease versions are not enabling bzlmod. Rather than add another value to the list, we only need to disable bzlmod by default for Bazel 6, and now this is permanently fixed.
If there was a target with slash in the name, such as `foo/bar`, go-to-definition would not work.

What was happening is that in resolve_label, we were unconditionally appending the target name to the directory, which might end up with something like `/path/to/file/foo` if the target is named `foo`, or `/path/to/file/foo/bar` if the target is named `foo/bar`. This then branches to looking at this value for a file path, and then the _parent_ of this value for a directory to look for a BUILD file in. The issue is that `/path/to/file/foo/bar`'s parent is `/path/to/file/foo`, which doesn't exist. In cases where a slash isn't in the target name, the join() and parent() cancel each other out.

The fix is to delay joining the target name, and only do this for the source file path. This avoids join + parent cancelling incorrectly, and just directly uses the base path.
While lexing a triple-quoted string, hitting an escape sequence would not reset the three-quote count. So something like "\\"\\" would still count as 3 quotes, even though it should get reset in the middle.

Fixes withered-magic#422
Expressions such as `[] + [1]` would resolve to `list[Unknown | int]`, which is a bit annoying. Worse, you could get warnings when doing even more logic on this, like passing to a rule which expects a `list[int]`.

When constructing empty containers, we now use a separate placeholder `EmptyUnspecified`, which allows us to nicely merge these types with other ones.

This also handles dicts and tuples in similar ways, though they're a bit more compilated since there are multiple elements.
@Ahajha Ahajha closed this Oct 1, 2026
@Ahajha

Ahajha commented Oct 1, 2026 •

Copy link
Copy Markdown
Author

whoops, sorry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant