mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
Better handling of attribute definition errors. Resolves #753
This commit is contained in:
committed by
Christoffer Lerno
parent
b794c893d6
commit
07b107ff5e
@@ -1839,12 +1839,8 @@ static bool sema_analyse_attributes_inner(SemaContext *context, Decl *decl, Attr
|
||||
|
||||
// Custom attributes.
|
||||
// First find it.
|
||||
Decl *attr_decl = sema_find_symbol(context, attr->name);
|
||||
if (!attr_decl || attr_decl->decl_kind != DECL_ATTRIBUTE)
|
||||
{
|
||||
SEMA_ERROR(attr, "The attribute '%s' could not be found.", attr->name);
|
||||
return false;
|
||||
}
|
||||
Decl *attr_decl = sema_resolve_symbol(context, attr->name, attr->path, attr->span);
|
||||
if (!attr_decl) return false;
|
||||
|
||||
// Detect direct cycles @Foo = @Bar @Bar = @Foo
|
||||
if (attr_decl == top)
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define COMPILER_VERSION "0.4.514"
|
||||
#define COMPILER_VERSION "0.4.515"
|
||||
7
test/test_suite/attributes/attr_not_imported.c3
Normal file
7
test/test_suite/attributes/attr_not_imported.c3
Normal file
@@ -0,0 +1,7 @@
|
||||
module abc;
|
||||
|
||||
define @Foo = { @inline };
|
||||
|
||||
module bar;
|
||||
|
||||
fn void test() abc::@Foo {} // #error: Did you mean the attribute
|
||||
Reference in New Issue
Block a user