diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 2f4287f35d..5ee6b954af 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -5982,7 +5982,8 @@ fn (mut c Checker) comp_if_branch(cond ast.Expr, pos token.Position) bool { type_node := cond.right as ast.TypeNode sym := c.table.get_type_symbol(type_node.typ) if sym.kind != .interface_ { - c.error('`$sym.name` is not an interface', cond.right.position()) + c.expr(cond.left) + // c.error('`$sym.name` is not an interface', cond.right.position()) } return false } else if cond.left is ast.SelectorExpr || cond.left is ast.TypeNode { diff --git a/vlib/v/gen/c/comptime.v b/vlib/v/gen/c/comptime.v index ff8a1ca2ec..1bc8c34d0a 100644 --- a/vlib/v/gen/c/comptime.v +++ b/vlib/v/gen/c/comptime.v @@ -319,7 +319,8 @@ fn (mut g Gen) comp_if_cond(cond ast.Expr) bool { got_type := (cond.right as ast.TypeNode).typ // Handle `$if x is Interface {` // mut matches_interface := 'false' - if left is ast.TypeNode && cond.right is ast.TypeNode { + if left is ast.TypeNode && cond.right is ast.TypeNode + && g.table.get_type_symbol(got_type).kind == .interface_ { // `$if Foo is Interface {` interface_sym := g.table.get_type_symbol(got_type) if interface_sym.info is ast.Interface {