MeAmAnUsername / pie

Pipelines for Interactive Environments
Apache License 2.0
0 stars 0 forks source link

Value declaration compiles to unit #295

Open MeAmAnUsername opened 2 years ago

MeAmAnUsername commented 2 years ago

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: 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()