aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaytan <laytanlaats@hotmail.com>2025-12-30 01:29:18 +0100
committerGitHub <noreply@github.com>2025-12-30 01:29:18 +0100
commitbbd4c38f8f48c4c6db554a46760bb11e7c0209c1 (patch)
tree6d736bb979eea1d8ce22535194412a470951337d /src
parent811f4c13cdc903387cc2a5bc1a34ebfdc763c9c2 (diff)
parentef33e551825258b51f095d3e52945b57fc795c4e (diff)
Merge pull request #6082 from harold-b/hb.fix-objc-auto-msgsend-class-methods
Fix auto objc_msgSend incorrectly treating certain class methods as instance methods.
Diffstat (limited to 'src')
-rw-r--r--src/check_expr.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index 2fe6c0251..3b32d734a 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -8172,13 +8172,7 @@ gb_internal void check_objc_call_expr(CheckerContext *c, Operand *operand, Ast *
Type *return_type = proc.result_count == 0 ? nullptr : proc.results->Tuple.variables[0]->type;
bool is_return_instancetype = return_type != nullptr && return_type == t_objc_instancetype;
- if (params.count == 0 || !is_type_objc_ptr_to_object(params[0]->type)) {
- if (!proc_entity->Procedure.is_objc_class_method) {
- // Not a class method, invalid call
- error(call, "Invalid Objective-C call: The Objective-C method is not a class method but this first parameter is not an Objective-C object pointer.");
- return;
- }
-
+ if (proc_entity->Procedure.is_objc_class_method) {
if (is_return_instancetype) {
if (ce->proc->kind == Ast_SelectorExpr) {
ast_node(se, SelectorExpr, ce->proc);
@@ -8194,7 +8188,8 @@ gb_internal void check_objc_call_expr(CheckerContext *c, Operand *operand, Ast *
self_type = t_objc_Class;
params_start = 0;
- } else if (ce->args.count > 0) {
+ } else {
+ GB_ASSERT(ce->args.count > 0);
GB_ASSERT(is_type_objc_ptr_to_object(params[0]->type));
if (ce->args[0]->tav.objc_super_target) {