diff --git a/src/compiler/sema_decls.c b/src/compiler/sema_decls.c index c48f02838..fc756d309 100644 --- a/src/compiler/sema_decls.c +++ b/src/compiler/sema_decls.c @@ -1486,6 +1486,8 @@ static inline bool sema_analyse_method(SemaContext *context, Decl *decl) bool is_dynamic = decl->func_decl.attr_dynamic; bool is_interface = decl->func_decl.attr_interface; if (is_interface && type != type_any) RETURN_SEMA_ERROR(decl, "Only 'any' methods may use '@interface'."); + if (!vec_size(params)) RETURN_SEMA_ERROR(decl, "A method must start with an argument of the type " + "it is a method of, e.g. 'fn Foo.test(Foo* foo)'."); if (!sema_is_valid_method_param(context, params[0], type, is_dynamic, is_interface)) return false; if (is_dynamic) { diff --git a/src/version.h b/src/version.h index 8e3692943..540547842 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define COMPILER_VERSION "0.4.528" \ No newline at end of file +#define COMPILER_VERSION "0.4.529" \ No newline at end of file