From 3babc60f1f43535ef7d4e42290092139ad110378 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 3 Jun 2026 10:47:34 -0700 Subject: [PATCH] Add support for nodeps bazel_deps To use nodeps with bzlmod you set `repo_name = None` which before this change showed an error. https://docs.google.com/document/d/1JsfbH9kdMe3dyOY-IR8SUakS541A7OM8pQcKpxTRMRs/edit?tab=t.0#heading=h.5mcn15i0e1ch --- .../data/module-bazel.builtins.json | 2 +- crates/starpls_hir/src/typeck/tests.rs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/crates/starpls_bazel/data/module-bazel.builtins.json b/crates/starpls_bazel/data/module-bazel.builtins.json index dd58915..2d46767 100644 --- a/crates/starpls_bazel/data/module-bazel.builtins.json +++ b/crates/starpls_bazel/data/module-bazel.builtins.json @@ -106,7 +106,7 @@ }, { "name": "repo_name", - "type": "string", + "type": "string; or None", "doc": "The name of the external repo representing this dependency. This is by default the name of the module.", "default_value": "''", "is_mandatory": false, diff --git a/crates/starpls_hir/src/typeck/tests.rs b/crates/starpls_hir/src/typeck/tests.rs index 98d04ad..c09c689 100644 --- a/crates/starpls_hir/src/typeck/tests.rs +++ b/crates/starpls_hir/src/typeck/tests.rs @@ -202,6 +202,23 @@ fn check_infer_with_options(input: &str, expect: Expect, options: InferenceOptio expect.assert_eq(&res); } +#[test] +fn test_module_bazel_flag_alias_builtin() { + let mut db = TestDatabaseBuilder::default().build(); + let file = db.create_file( + FileId(0), + Dialect::Bazel, + Some(FileInfo::Bazel { + api_context: APIContext::Module, + is_external: false, + }), + r#"flag_alias(name = "foo", starlark_flag = "//defs:foo")"#.to_string(), + ); + + let diagnostics = db.gcx.with_tcx(&db, |tcx| tcx.diagnostics_for_file(file)); + assert!(diagnostics.is_empty(), "{diagnostics:#?}"); +} + #[test] fn test_infer_basic_exprs() { check_infer(