Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Dec 14, 2024
1 parent b39cad2 commit d6dded4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions vlib/v/checker/assign.v
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ fn (mut c Checker) assign_stmt(mut node ast.AssignStmt) {
c.error('cannot reassign using range expression on the left side of an assignment',
left.pos)
}
} else if mut left is ast.Ident && node.op == .decl_assign {
if left.name in c.global_names {
c.error('already exists a global variable named `${left.name}`', left.pos)
}
}
is_blank_ident := left.is_blank_ident()
mut left_type := ast.void_type
Expand Down

0 comments on commit d6dded4

Please sign in to comment.