rascal
rascal copied to clipboard
"UndeclaredVariable" when assigning into a unset keyword field of a ADT constructor
Describe the bug
>rascal>data X = x(map[str,str] namen=());
ok
rascal>X example = x();
X: x()
rascal>example.namen["jurgen"] = "vinju";
|prompt:///|(0,13,<1,0>,<1,13>): Uninitialized variable
Advice: |https://www.rascal-mpl.org/docs/Rascal/Errors/CompileTimeErrors/UninitializedVariable/UninitializedVariable.html|
This makes little sense to me. I expected the example.namen to produce the empty map by the default definition, then setting the key "jurgen" to "vinju", then assigning the new map into example.namen, then returning the new example value.
@PaulKlint how does the generated code handle this case?