Skip to content

Commit 0bab94c

Browse files
committed
test(python): a def under a branch is bound by the lexical step, not the LSP
At a compound statement's join the Python LSP invalidates what the branch bound, so the local def under if True: is resolved by the registry's lexical_scope step; pin that producer instead of an lsp_ strategy. Found at the branch's first build. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent 9b5139d commit 0bab94c

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎tests/test_pipeline.c‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14642,15 +14642,21 @@ static int pyn_assert_shadowing(cbm_store_t *s, const char *project) {
1464214642
"\"strategy\":\"lsp_super\""));
1464314643
ASSERT_TRUE(pyn_edge_with(s, project, "sc.factory.Local.other", "sc.factory.Local.greet",
1464414644
"CALLS", "\"strategy\":\"lsp_"));
14645+
/* sa's local def is a plain statement of the body: the LSP binds it as an
14646+
* exact callable. sb's sits under `if True:`; at that compound statement's
14647+
* join the LSP invalidates what the branch bound (the def may not exist on
14648+
* every path), so it emits nothing and the registry's lexical step binds
14649+
* the local -- still never the module def. */
1464514650
const char *files[] = {"sa", "sb"};
14651+
const char *local_strategy[] = {"\"strategy\":\"lsp_", "\"strategy\":\"lexical_scope\""};
1464614652
for (int f = 0; f < 2; f++) {
1464714653
char local_caller[64], local_def[64], module_caller[64], module_def[64];
1464814654
snprintf(local_caller, sizeof(local_caller), "%s.uses_local", files[f]);
1464914655
snprintf(local_def, sizeof(local_def), "%s.uses_local.helper", files[f]);
1465014656
snprintf(module_caller, sizeof(module_caller), "%s.uses_module", files[f]);
1465114657
snprintf(module_def, sizeof(module_def), "%s.helper", files[f]);
14652-
ASSERT_TRUE(pyn_edge_with(s, project, local_caller, local_def, "CALLS",
14653-
"\"strategy\":\"lsp_"));
14658+
ASSERT_TRUE(
14659+
pyn_edge_with(s, project, local_caller, local_def, "CALLS", local_strategy[f]));
1465414660
ASSERT_FALSE(pyn_edge(s, project, local_caller, module_def, "CALLS"));
1465514661
ASSERT_TRUE(pyn_edge(s, project, module_caller, module_def, "CALLS"));
1465614662
ASSERT_FALSE(pyn_edge(s, project, module_caller, local_def, "CALLS"));

0 commit comments

Comments
 (0)