Summary
The value of a value declaration is supposed to be its expression, but it compiles to unit
Todo
[ ] Add tests
[ ] SingleBinder valdec
[ ] MultiBinder valdec
[ ] Fix bug
ReproductionGiven:func valDec() -> int = val x = 7, run Spoofax > Generate > Java
Expected: generates
@Override public Integer exec(ExecContext execContext, None input) throws Exception {
final Integer x = new Integer (7);
return x;
}
Actual: generates
@Override public Integer exec(ExecContext execContext, None input) throws Exception {
final Integer x = new Integer (7);
return None.instance;
}
Details
Value declarations used to have unit type and value. The intended semantics were changed to be the type and value of the expression that is assigned. Static analysis correctly gives no errors on the example function, but the compiler still generates UnitLit()
Summary The value of a value declaration is supposed to be its expression, but it compiles to
unit
Todo
Reproduction Given:
func valDec() -> int = val x = 7
, run Spoofax > Generate > Java Expected: generatesActual: generates
Details Value declarations used to have unit type and value. The intended semantics were changed to be the type and value of the expression that is assigned. Static analysis correctly gives no errors on the example function, but the compiler still generates
UnitLit()