Skip to content

Commit 198d5b3

Browse files
committed
test(python): read module-range bindings through CBMVarBinding
cbm_scope_lookup_local returns the binding, not its type, so the range tests passed a const CBMVarBinding * where a const CBMType * was expected and the test runner did not compile (-Werror,-Wincompatible-pointer-types). Type checks now go through pylsp_local_type, Hidden keeps the binding so the package case still asserts that nothing is bound, and shadow_only checks the type of its binding. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent 24eb264 commit 198d5b3

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

‎tests/test_py_lsp.c‎

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4640,20 +4640,21 @@ TEST(pylsp_range_class_binding_keeps_order_shadow_and_package_filters) {
46404640
pylsp_range_reset_failures();
46414641
ok = shadowed && !ctx.callable_value_proof_disabled &&
46424642
ctx.eval_failure == CBM_LSP_COMPLETE &&
4643-
pylsp_init_named_type(cbm_scope_lookup_local(ctx.current_scope, "Shared"),
4643+
pylsp_init_named_type(pylsp_local_type(ctx.current_scope, "Shared"),
46444644
"test.pkg.Tail") &&
4645-
pylsp_init_named_type(cbm_scope_lookup_local(ctx.current_scope, "HeadSame"),
4645+
pylsp_init_named_type(pylsp_local_type(ctx.current_scope, "HeadSame"),
46464646
"test.pkg.Same") &&
4647-
pylsp_init_named_type(cbm_scope_lookup_local(ctx.current_scope, "MiddleOnly"),
4647+
pylsp_init_named_type(pylsp_local_type(ctx.current_scope, "MiddleOnly"),
46484648
"test.pkg.Deep") &&
4649-
pylsp_init_named_type(cbm_scope_lookup_local(ctx.current_scope, "TailOnly"),
4649+
pylsp_init_named_type(pylsp_local_type(ctx.current_scope, "TailOnly"),
46504650
"test.pkg.Deep") &&
46514651
!cbm_scope_lookup_local(ctx.current_scope, "Masked") &&
46524652
!cbm_scope_lookup_local(ctx.current_scope, "Local") && ok;
4653-
const CBMType *hidden = cbm_scope_lookup_local(ctx.current_scope, "Hidden");
4654-
ok =
4655-
(package ? hidden == NULL : pylsp_init_named_type(hidden, "test.pkg.sub.Hidden")) &&
4656-
ok;
4653+
const CBMVarBinding *hidden = cbm_scope_lookup_local(ctx.current_scope, "Hidden");
4654+
ok = (package ? hidden == NULL
4655+
: pylsp_init_named_type(hidden ? hidden->type : NULL,
4656+
"test.pkg.sub.Hidden")) &&
4657+
ok;
46574658
cbm_arena_destroy(&arena);
46584659
cbm_arena_destroy(&owner);
46594660
}
@@ -4725,9 +4726,9 @@ TEST(pylsp_range_wildcard_and_scratch_failures_keep_exact_later_calls) {
47254726
atomic_load_explicit(&cbm_py_wildcard_invalidations, memory_order_relaxed);
47264727
py_lsp_process_file(&ctx, ts_tree_root_node(tree));
47274728
pylsp_range_reset_failures();
4728-
const CBMType *shadow = cbm_scope_lookup_local(ctx.current_scope, "shadow_only");
4729+
const CBMVarBinding *shadow = cbm_scope_lookup_local(ctx.current_scope, "shadow_only");
47294730
ok = built && ctx.eval_failure == CBM_LSP_COMPLETE && !ctx.callable_value_proof_disabled &&
4730-
shadow && cbm_type_is_unknown(shadow) &&
4731+
shadow && cbm_type_is_unknown(shadow->type) &&
47314732
atomic_load_explicit(&cbm_py_wildcard_invalidations, memory_order_relaxed) > before &&
47324733
pylsp_module_site_joins(&raw->calls, &out, source, "external.ping()", "test.main",
47334734
"test.main.External.ping") &&

0 commit comments

Comments
 (0)