Fix missing check when macro method incorrectly has a raw vararg argument.

This commit is contained in:
Christoffer Lerno
2022-12-03 23:07:37 +01:00
parent 10b0b5f9c7
commit 7647378e7c
4 changed files with 15 additions and 3 deletions

View File

@@ -2170,11 +2170,15 @@ static bool sema_analyse_macro_method(SemaContext *context, Decl *decl)
}
if (!vec_size(decl->func_decl.signature.params))
{
SEMA_ERROR(decl, "Expected at least one parameter - of type %s.", type_to_error_string(parent_type));
SEMA_ERROR(decl, "Expected at least one parameter - of type '%s'.", type_to_error_string(parent_type));
return false;
}
Decl *first_param = decl->func_decl.signature.params[0];
if (!first_param)
{
SEMA_ERROR(decl, "The first parameter to this method must be of type '%s'.", type_to_error_string(parent_type));
return false;
}
if (!sema_is_valid_method_param(context, first_param, parent_type->canonical)) return false;
if (first_param->var.kind != VARDECL_PARAM_REF && first_param->var.kind != VARDECL_PARAM)

View File

@@ -1 +1 @@
#define COMPILER_VERSION "0.3.103"
#define COMPILER_VERSION "0.3.104"

View File

@@ -0,0 +1,4 @@
struct Foo { int y; }
macro Foo.text(...) = f.y; // #error: The first parameter to this method must

View File

@@ -0,0 +1,4 @@
struct Foo { int y; }
macro Foo.text(...) = f.y; // #error: The first parameter to this method must