Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Dec 29, 2024
1 parent dd75c4b commit b3d3b49
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions vlib/v/checker/infix.v
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ fn (mut c Checker) infix_expr(mut node ast.InfixExpr) ast.Type {
right_expr := node.right
mut typ := match right_expr {
ast.TypeNode {
c.unwrap_generic(right_expr.typ)
right_expr.typ
}
ast.None {
ast.none_type_idx
Expand Down Expand Up @@ -794,7 +794,8 @@ fn (mut c Checker) infix_expr(mut node ast.InfixExpr) ast.Type {
c.error('`${op}` can only be used with interfaces and sum types',
node.pos) // can be used in sql too, but keep err simple
} else if mut left_sym.info is ast.SumType {
if typ !in left_sym.info.variants {
if typ !in left_sym.info.variants
&& c.unwrap_generic(typ) !in left_sym.info.variants {
c.error('`${left_sym.name}` has no variant `${right_sym.name}`',
right_pos)
}
Expand Down

0 comments on commit b3d3b49

Please sign in to comment.