According to the specification section 3.2:
A symbol MAY be declared without a value using TYPE name. Such a declaration records the symbol's static type but does not create a readable runtime binding until an assignment occurs. The type and name MUST be separated by one or more space characters, and no other character MAY appear between them.
And the specification section 1:
Prefix is a statically typed, imperative, interpreted programming language focused on explicit, readable source code.
In the implementation, however, attempting to specify a symbol's type without assigning a value does nothing if that type conflicts the existing static type for that symbol, rather than erroring.
Example:
Prefix REPL. Enter statements, blank line to run buffer.
>>> INT n = 0d1
>>> PRINT(TYPE(n))
INT
>>> BOOL n
>>> PRINT(TYPE(n))
INT
>>> n = TRUE
Traceback (most recent call last):
File "<repl>", line 1, in <top-level>
n = TRUE
State log index: 4 State id: s_000004
RuntimeError: Type mismatch: expected INT but got BOOL (rewrite: ASSIGN)
Update the implementation, and add a regression test.
According to the specification section 3.2:
And the specification section 1:
In the implementation, however, attempting to specify a symbol's type without assigning a value does nothing if that type conflicts the existing static type for that symbol, rather than erroring.
Example:
Update the implementation, and add a regression test.