-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Refactor type unification code #3409
Conversation
* Coercion rules were duplicated in the original code (and diverged). The rules appear only once in the code after this commit. * Coercion between types with type parameters (e.g. array<T> and array<U>) could be arbitrary and potentially complex. After this commit, coercibility between types is decoupled from compatibility between type parameters.
|
||
private HashMap<T, Entry> map = new HashMap<>(); | ||
|
||
private boolean union(T root1, T root2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move below public methods
Do I read it correctly that this is a POC? |
} | ||
else if (rightVs != null) { | ||
leftVs.addAll(rightVs); | ||
map.remove(leftVs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
invalid call
@sopel39, yes, was the result of a hackathon project. |
Superceded by #4131 |
The first commit refactors getCommonSuperType and canCoerce:
The second commit refactors type unification code to make it more flexible so that it can be extended to support more complex use cases (lambda).