Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type deduction for records #139

Open
julianhyde opened this issue Apr 13, 2022 · 0 comments
Open

Type deduction for records #139

julianhyde opened this issue Apr 13, 2022 · 0 comments

Comments

@julianhyde
Copy link
Collaborator

Improve type deduction for records. For example,

fun hasJob e job =
  e.job = job;

throws

java.lang.ClassCastException: net.hydromatic.morel.type.TypeVar cannot be cast to net.hydromatic.morel.type.RecordLikeType

and has to be changed to

fun hasJob (e: {name: string, job: string, empno: int}) job =
  e.job = job;

in order to compile. Ideally we would infer record types (or constraints on record types) but at a minimum we should give a good error, not throw ClassCastException.

julianhyde added a commit to julianhyde/morel that referenced this issue Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant