From e738d671a5402b782cae8acaa6e7f4d01a424cdf Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sat, 29 Apr 2023 11:07:24 -0300 Subject: [PATCH] checker: fix [noinit] attr checking with multiple attr (#18079) --- vlib/v/checker/struct.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vlib/v/checker/struct.v b/vlib/v/checker/struct.v index 766fcc1ffc..4c436accc9 100644 --- a/vlib/v/checker/struct.v +++ b/vlib/v/checker/struct.v @@ -398,7 +398,7 @@ fn (mut c Checker) struct_init(mut node ast.StructInit, is_field_zero_struct_ini } if type_sym.kind == .struct_ { info := type_sym.info as ast.Struct - if info.attrs.len > 0 && info.attrs[0].name == 'noinit' && type_sym.mod != c.mod { + if info.attrs.len > 0 && info.attrs.contains('noinit') && type_sym.mod != c.mod { c.error('struct `${type_sym.name}` is declared with a `[noinit]` attribute, so ' + 'it cannot be initialized with `${type_sym.name}{}`', node.pos) }