hydromatic / morel

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

Morel gives unhelpful "unresolved flex record" error #175

Open julianhyde opened 2 years ago

julianhyde commented 2 years ago

The expression

from e in scott.emps yield e.ename

gives the error

unresolved flex record (can't tell what fields there are besides #ename)

The error is misleading. The cause is that I should have written scott.emp rather than scott.emps. Morel knows that scott has fields bonus, emp, dept, salgrade so should have been able to give a more specific error.

And in fact it can do so if you use scott in a different way:

- scott.emps;
no field 'emps' in type '{bonus:{comm:real, ename:string, job:string, sal:real} list, dept:{deptno:int, dname:string, loc:string} list, emp:{comm:real, deptno:int, empno:int, ename:string, hiredate:string, job:string, mgr:int, sal:real} list, salgrade:{grade:int, hisal:real, losal:real} list}'