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

Unify early in type inference #146

Open
joshsh opened this issue Feb 5, 2025 · 3 comments
Open

Unify early in type inference #146

joshsh opened this issue Feb 5, 2025 · 3 comments
Assignees

Comments

@joshsh
Copy link
Collaborator

joshsh commented Feb 5, 2025

There are currently some unresolved bugs in type inference which impact the Java coder more than anything else. While the inference solution is "good enough" for most purposes, the Heisenbugs are standing in the way of a 1.0 release. Inference has been challenging to debug in the past due to the fact that unification strictly follows type inference: as we infer types from terms, we collect a set of type constraints, then unify over all of those constraints at once. This makes problems in any one inference rule hard to localize.

There is no reason unification needs to happen all at once; we can unify after each rule, and potentially spot problems sooner. Although inference doesn't actually fail in the case of these bugs (it just produces wrong answers), it will not hurt to have a smaller set of constraints to work with while debugging.

@joshsh joshsh self-assigned this Feb 5, 2025
@wisnesky
Copy link
Contributor

wisnesky commented Feb 6, 2025

are these heisenbugs in the sense of being non-deterministic?

@joshsh
Copy link
Collaborator Author

joshsh commented Feb 6, 2025

In the sense of being bugs which seemingly disappear when you try to investigate them. As you decompose the problem into smaller problems, the interactions (between constraints from different rules/levels) which gave rise to the problem disappear.

@wisnesky
Copy link
Contributor

wisnesky commented Feb 6, 2025

I tend to agree that unifying on every step simplifies debugging, but if you can post examples we can try to debug the current system

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants