mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: disallow interfaces inside sum types (#6232)
This commit is contained in:
parent
8dcc73993e
commit
3e9dc578de
@ -293,6 +293,8 @@ pub fn (mut c Checker) type_decl(node ast.TypeDecl) {
|
|||||||
typ_sym := c.table.get_type_symbol(typ)
|
typ_sym := c.table.get_type_symbol(typ)
|
||||||
if typ_sym.kind == .placeholder {
|
if typ_sym.kind == .placeholder {
|
||||||
c.error("type `$typ_sym.source_name` doesn't exist", node.pos)
|
c.error("type `$typ_sym.source_name` doesn't exist", node.pos)
|
||||||
|
} else if typ_sym.kind == .interface_ {
|
||||||
|
c.error("sum type cannot hold an interface", node.pos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user