| 3139 | } |
| 3140 | |
| 3141 | static bool pylsp_init_signature(const CBMTypeRegistry *registry, const char *function, |
| 3142 | const char *expected_type) { |
| 3143 | const CBMRegisteredFunc *f = cbm_registry_lookup_func(registry, function); |
| 3144 | const CBMType *sig = f ? f->signature : NULL; |
| 3145 | if (!sig || sig->kind != CBM_TYPE_FUNC || !sig->data.func.param_types) |
| 3146 | return false; |
| 3147 | const CBMType **params = sig->data.func.param_types; |
| 3148 | if (!pylsp_init_named_type(params[0], expected_type) || |
| 3149 | !pylsp_init_named_type(params[1], expected_type) || !params[2] || params[3]) |
| 3150 | return false; |
| 3151 | const CBMType *container = params[2]; |
| 3152 | return container->kind == CBM_TYPE_TEMPLATE && container->data.template_type.template_name && |
| 3153 | strcmp(container->data.template_type.template_name, "list") == 0 && |
| 3154 | container->data.template_type.arg_count == 1 && |
| 3155 | container->data.template_type.template_args && |
| 3156 | pylsp_init_named_type(container->data.template_type.template_args[0], expected_type); |
| 3157 | } |
| 3158 | |
| 3159 | TEST(pylsp_init_scope_cross_signatures_keep_definition_language) { |
| 3160 | const char *params[] = {"Token", "'Token'", "list[Token]"}; |
no test coverage detected