@tag didn't work with members #2236.

This commit is contained in:
Christoffer Lerno
2025-06-23 14:45:16 +02:00
parent 1b2f5989e1
commit affb722b23
3 changed files with 16 additions and 1 deletions

View File

@@ -61,7 +61,8 @@
- Overload resolution fixes to inline typedef #2226.
- `math::overflow_*` wrappers incorrectly don't allow distinct integers #2221.
- Compiler segfault when using distinct type in attribute imported from other module #2234.
- Assert casting bitstruct to short/char #2237
- Assert casting bitstruct to short/char #2237.
- @tag didn't work with members #2236.
### Stdlib changes
- Deprecate `String.is_zstr` and `String.quick_zstr` #2188.

View File

@@ -3594,6 +3594,7 @@ static bool sema_analyse_attributes_inner(SemaContext *context, ResolvedAttrData
static bool sema_analyse_attributes(SemaContext *context, Decl *decl, Attr **attrs, AttributeDomain domain,
bool *erase_decl)
{
if (decl->resolved_attributes) return true;
ResolvedAttrData data = { .tags = NULL, .overload = INVALID_SPAN };
if (!sema_analyse_attributes_inner(context, &data, decl, attrs, domain, NULL, erase_decl)) return false;
if (*erase_decl) return true;

View File

@@ -0,0 +1,13 @@
struct Test
{
union a @tag("a", 1)
{
int x;
}
}
fn int main(String[] args)
{
$assert(Test.a.has_tagof("a")); // Error: Compile time assert failed.
return 0;
}