hydromatic / morel

Standard ML interpreter, with relational extensions, implemented in Java
Apache License 2.0
291 stars 15 forks source link

Require that a non-terminal `yield` step is a record expression #213

Closed julianhyde closed 5 months ago

julianhyde commented 5 months ago

Require that non-terminal yield steps (i.e. those that are not the last step in their from expression) is a record expression ({field = expr, field = expr, ...}).

For example,

from d in scott.dept yield d where deptno > 10

should give the error

'yield' step that is not last in 'from' must be a record expression

Note that d has record type but is not a record expression. We may allow that in future, but it's tricky for the type deduction algorithm to see that deptno is a valid field.

The following should give the same error, because yield expression has type int and tuple:

from d in scott.dept yield d.deptno yield 1;
from d in scott.dept yield (d.deptno, d.loc) yield 1;

As before, if yield is the last step it can have any kind of expression.