rascal
rascal copied to clipboard
Can not declare type for variables initialized by for expressions
Describe the bug
for can be used as expressions, as verified by the following code:
L = for (int i <- [1..5]) append i * i;
but when I add type declaration for L, I got parse error.
list[int] L = for (int i <- [1..5]) append i * i;
To Reproduce
Steps to reproduce the behavior:
- Execute the following statement in REPL.
list[int] L = for (int i <- [1..5]) append i * i; - See parse error in REPL.
Expected behavior
A list[int] variable named L should be defined without error instead of parse error.
Screenshots

Stack traces None
Desktop (please complete the following information):
- Context: Commandline REPL
- Rascal Version [e.g. 0.23.0], stable release
Additional context None