From 5f87cb4c4fdc21f010d0b4aec6b9e5cf324f5dc6 Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Tue, 13 Jun 2023 18:30:57 +0200 Subject: [PATCH] Fix of #780. --- src/compiler/sema_decls.c | 2 ++ src/version.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) 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