-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Labels
priority:p2Medium priorityMedium priorityscope:compilertype:bugSomething isn't workingSomething isn't working
Milestone
Description
there are two main ways of declaring a variable type:
- using
varkeyword.var 0@: int,var $var: int - using a predefined type followed by variable name:
int a,int 0@,int $var
For local variables (@) and global variables ($, &) the end result is the same regardless of the chosen syntax.
For identifiers the results are different.
int a acts similarly to const a = 0@
var a: int yields no error, but does not create a new variable either. var a: int = 100 produces an error
declaring another constant with the same name shadows the variable declaration:
const a = $100
int a
a = 1 // expected local var 0@, got $100
const a = $100
var a: int = 100 // compiles as $100 = 0
Expectation
const a = $100
int a = 0
should throw a duplicate constant name error
2. var a: int should mirror int a behavior
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
priority:p2Medium priorityMedium priorityscope:compilertype:bugSomething isn't workingSomething isn't working