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

Refactor type unification code #3409

Closed
wants to merge 2 commits into from
Closed

Conversation

haozhun
Copy link
Contributor

@haozhun haozhun commented Aug 5, 2015

The first commit refactors getCommonSuperType and canCoerce:

  • 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 and array) could be arbitrary and potentially complex. After this commit, coercibility between types is decoupled into 2 parts: compatibility between their based types and between their type parameters.

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).

haozhun added 2 commits August 5, 2015 15:38
* 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move below public methods

@sopel39
Copy link
Contributor

sopel39 commented Oct 23, 2015

Do I read it correctly that this is a POC?

}
else if (rightVs != null) {
leftVs.addAll(rightVs);
map.remove(leftVs);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

invalid call

@martint
Copy link
Contributor

martint commented Oct 23, 2015

@sopel39, yes, was the result of a hackathon project.

@haozhun haozhun mentioned this pull request Nov 4, 2015
@haozhun
Copy link
Contributor Author

haozhun commented Dec 11, 2015

Superceded by #4131

@haozhun haozhun closed this Dec 11, 2015
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

Successfully merging this pull request may close these issues.

5 participants