Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Nov 7, 2023
1 parent a4d170f commit d8a525c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vlib/v/checker/assign.v
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,8 @@ fn (mut c Checker) assign_stmt(mut node ast.AssignStmt) {
c.error('duplicate of an import symbol `${left.name}`', left.pos)
}
}
if node.op == .assign && left_type.has_flag(.option) && right is ast.UnsafeExpr {
if node.op == .assign && left_type.has_flag(.option) && right is ast.UnsafeExpr
&& right.expr.is_nil() {
c.error('cannot assign `nil` to option value', right.pos())
}
}
Expand Down

0 comments on commit d8a525c

Please sign in to comment.