Skip to content

Commit

Permalink
[7.4.0] Show "did you mean" suggestion for {override,inject}_repo (#…
Browse files Browse the repository at this point in the history
…24000)

Fixes #23981

Closes #23982.

PiperOrigin-RevId: 686486627
Change-Id: I5f03b63601a535f8d551c005b00bf040846a324d

Commit
b0f1430

Co-authored-by: Fabian Meumertzheim <[email protected]>
  • Loading branch information
bazel-io and fmeum authored Oct 17, 2024
1 parent c118308 commit a99de87
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ java_library(
"//src/main/java/com/google/devtools/build/skyframe:skyframe-objects",
"//src/main/java/net/starlark/java/annot",
"//src/main/java/net/starlark/java/eval",
"//src/main/java/net/starlark/java/spelling",
"//src/main/java/net/starlark/java/syntax",
"//src/main/protobuf:failure_details_java_proto",
"//third_party:auto_value",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import net.starlark.java.eval.EvalException;
import net.starlark.java.eval.Starlark;
import net.starlark.java.eval.StarlarkThread;
import net.starlark.java.spelling.SpellChecker;
import net.starlark.java.syntax.Location;

/** Context object for a Starlark thread evaluating the MODULE.bazel file and files it includes. */
Expand Down Expand Up @@ -257,8 +258,11 @@ ModuleExtensionUsage buildUsage() throws EvalException {
if (!context.repoNameUsages.containsKey(overridingRepoName)) {
throw Starlark.errorf(
"The repo exported as '%s' by module extension '%s' is overridden with '%s', but"
+ " no repo is visible under this name",
overriddenRepoName, extensionName, overridingRepoName)
+ " no repo is visible under this name%s",
overriddenRepoName,
extensionName,
overridingRepoName,
SpellChecker.didYouMean(overridingRepoName, context.repoNameUsages.keySet()))
.withCallStack(override.getValue().stack);
}
String importedAs = imports.inverse().get(overriddenRepoName);
Expand Down

0 comments on commit a99de87

Please sign in to comment.