From 3e9dc578deb5afa40b4ff80656a4fd8f0359d343 Mon Sep 17 00:00:00 2001 From: Xavier B Date: Thu, 27 Aug 2020 02:33:59 -0400 Subject: [PATCH] checker: disallow interfaces inside sum types (#6232) --- vlib/v/checker/checker.v | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 40330893af..80e7d5b411 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -293,6 +293,8 @@ pub fn (mut c Checker) type_decl(node ast.TypeDecl) { typ_sym := c.table.get_type_symbol(typ) if typ_sym.kind == .placeholder { 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) } } }