Skip to content

Use correct type equality in divergence check #6163

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

Merged
merged 1 commit into from
Mar 25, 2019

Conversation

milessabin
Copy link
Contributor

Fixes #6058.

@milessabin milessabin requested a review from odersky March 25, 2019 13:50
@odersky odersky merged commit 81732c0 into scala:master Mar 25, 2019
milessabin added a commit to milessabin/dotty that referenced this pull request Apr 17, 2019
The fix for scala#6058 in scala#6163 caused a significant performance regression
in the inductive implicits benchmark because the use of =:= rather than
== in the divergence check was significantly slower. It is the right
test however, so we need a quicker check to rule out negative cases.

We're already computing the covering sets and sizes of the two types
being compared. tp1 =:= tp2 should entail (sz1 == sz2 && cs1 == cs2), so
the contrapositive (sz1 != sz2 || cs1 != cs2) should entail that !(tp1
=:= tp2). However the covering set and size computations were incorrect
(they missed types mentioned in bounds which should have been included,
and included symbols for unsolved type variables which should not).

This commit fixes the latter issue, which allows covering set and size
tests to be used to avoid expensive full type equality tests.
milessabin added a commit to milessabin/dotty that referenced this pull request Apr 24, 2019
The fix for scala#6058 in scala#6163 caused a significant performance regression
in the inductive implicits benchmark because the use of =:= rather than
== in the divergence check was significantly slower. It is the right
test however, so we need a quicker check to rule out negative cases.

We're already computing the covering sets and sizes of the two types
being compared. tp1 =:= tp2 should entail (sz1 == sz2 && cs1 == cs2), so
the contrapositive (sz1 != sz2 || cs1 != cs2) should entail that !(tp1
=:= tp2). However the covering set and size computations were incorrect
(they missed types mentioned in bounds which should have been included,
and included symbols for unsolved type variables which should not).

This commit fixes the latter issue, which allows covering set and size
tests to be used to avoid expensive full type equality tests.
anatoliykmetyuk pushed a commit to dotty-staging/dotty that referenced this pull request May 2, 2019
The fix for scala#6058 in scala#6163 caused a significant performance regression
in the inductive implicits benchmark because the use of =:= rather than
== in the divergence check was significantly slower. It is the right
test however, so we need a quicker check to rule out negative cases.

We're already computing the covering sets and sizes of the two types
being compared. tp1 =:= tp2 should entail (sz1 == sz2 && cs1 == cs2), so
the contrapositive (sz1 != sz2 || cs1 != cs2) should entail that !(tp1
=:= tp2). However the covering set and size computations were incorrect
(they missed types mentioned in bounds which should have been included,
and included symbols for unsolved type variables which should not).

This commit fixes the latter issue, which allows covering set and size
tests to be used to avoid expensive full type equality tests.
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.

2 participants