From 3e4d1de70e68cd5e4c604581c12db61fc0d8a96a Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Thu, 16 Jan 2025 22:09:53 +0100 Subject: [PATCH] Fix issue requiring prefix on a generic interface declaration. --- releasenotes.md | 2 +- src/compiler/compiler_internal.h | 4 +++- test/test_suite/any/generic_interface.c3 | 12 ++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 test/test_suite/any/generic_interface.c3 diff --git a/releasenotes.md b/releasenotes.md index 9be7e2de8..2752ac3d9 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -6,7 +6,7 @@ - None yet. ### Fixes -- None yet. +- Fix issue requiring prefix on a generic interface declaration. ### Stdlib changes - Added '%h' and '%H' for printing out binary data in hexadecimal using the formatter. diff --git a/src/compiler/compiler_internal.h b/src/compiler/compiler_internal.h index 598f7865a..258bf95f9 100644 --- a/src/compiler/compiler_internal.h +++ b/src/compiler/compiler_internal.h @@ -3214,7 +3214,9 @@ INLINE bool decl_is_user_defined_type(Decl *decl) { DeclKind kind = decl->decl_kind; return (kind == DECL_UNION) | (kind == DECL_STRUCT) | (kind == DECL_BITSTRUCT) - | (kind == DECL_ENUM) | (kind == DECL_TYPEDEF) || (kind == DECL_DISTINCT); + | (kind == DECL_ENUM) | (kind == DECL_TYPEDEF) | (kind == DECL_DISTINCT) + | (kind == DECL_INTERFACE) + ; } INLINE Decl *decl_flatten(Decl *decl) diff --git a/test/test_suite/any/generic_interface.c3 b/test/test_suite/any/generic_interface.c3 new file mode 100644 index 000000000..6bd257af5 --- /dev/null +++ b/test/test_suite/any/generic_interface.c3 @@ -0,0 +1,12 @@ +module foo(); + +interface Baz +{} + +module test; +import foo; + +fn void main() +{ + Baz() x; +}