diff --git a/src/compiler/sema_decls.c b/src/compiler/sema_decls.c index e58399912..59a7ca5ca 100644 --- a/src/compiler/sema_decls.c +++ b/src/compiler/sema_decls.c @@ -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) diff --git a/src/version.h b/src/version.h index 969ced473..afd94685e 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define COMPILER_VERSION "0.4.514" \ No newline at end of file +#define COMPILER_VERSION "0.4.515" \ No newline at end of file diff --git a/test/test_suite/attributes/attr_not_imported.c3 b/test/test_suite/attributes/attr_not_imported.c3 new file mode 100644 index 000000000..4e0ff3a4c --- /dev/null +++ b/test/test_suite/attributes/attr_not_imported.c3 @@ -0,0 +1,7 @@ +module abc; + +define @Foo = { @inline }; + +module bar; + +fn void test() abc::@Foo {} // #error: Did you mean the attribute