checker: fix the alias check
parent
9df29d0dd2
commit
4b0e606ae8
|
@ -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)
|
c.error('cannot instantiate interface `$type_sym.name`', struct_init.pos)
|
||||||
}
|
}
|
||||||
if type_sym.kind == .alias {
|
if type_sym.kind == .alias {
|
||||||
c.error('cannot instantiate type alias `$type_sym.name`', struct_init.pos)
|
info := type_sym.info as table.Alias
|
||||||
return table.void_type
|
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 {
|
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)
|
c.error('type `$type_sym.name` is private', struct_init.pos)
|
||||||
|
|
Loading…
Reference in New Issue