diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index d94ab9b31e..688b4f9f79 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -344,8 +344,11 @@ pub fn (mut c Checker) struct_init(mut struct_init ast.StructInit) table.Type { c.error('cannot instantiate interface `$type_sym.name`', struct_init.pos) } if type_sym.kind == .alias { - c.error('cannot instantiate type alias `$type_sym.name`', struct_init.pos) - return table.void_type + info := type_sym.info as table.Alias + if info.parent_typ.is_number() { + c.error('cannot instantiate number type alias `$type_sym.name`', struct_init.pos) + return table.void_type + } } if !type_sym.is_public && type_sym.kind != .placeholder && type_sym.mod != c.mod { c.error('type `$type_sym.name` is private', struct_init.pos)