1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

checker: temporary c2v struct init fix

This commit is contained in:
Alexander Medvednikov 2022-06-16 14:24:17 +03:00
parent df239b9208
commit 9c72b85f72

View File

@ -321,7 +321,8 @@ pub fn (mut c Checker) struct_init(mut node ast.StructInit) ast.Type {
if node.is_short {
exp_len := info.fields.len
got_len := node.fields.len
if exp_len != got_len {
if exp_len != got_len && !c.pref.translated {
// XTODO remove !translated check
amount := if exp_len < got_len { 'many' } else { 'few' }
c.error('too $amount fields in `$type_sym.name` literal (expecting $exp_len, got $got_len)',
node.pos)