Skip to content

Conversation

@milessabin
Copy link
Contributor

@milessabin milessabin commented Jan 17, 2018

This PR is a precondition for being able to enable partial unification unconditionally.

Turning partial unification on unconditionally revealed that in some error cases it was possible for the partial unification branch of unifySpecific to add inappropriately kinded bounds to the type variable
being solved. These later blow up in matchingBounds in GlbLubs where the mismatched kinds result in a NoCommonType exception being thrown which crashes the compiler reporting "lub/glb of incompatible types".

This commit prevents that from happening by checking that the added bounds will match the kind of the TypeVar they're being added to. If they don't then the bound is not added and unification fails.

Turning partial unification on unconditionally revealed that in some
error cases it was possible for the partial unification branch of
unifySpecific to add inappropriately kinded bounds to the type variable
being solved. These later blow up in matchingBounds in GlbLubs where the
mismatched kinds result in a NoCommonType exception being thrown which
crashes the compiler reporting "lub/glb of incompatible types".

This commit prevents that from happening by checking that the added
bounds will match the kind of the TypeVar they're being added to. If
they don't then the bound is not added and unification fails.
@scala-jenkins scala-jenkins added this to the 2.13.0-M4 milestone Jan 17, 2018
@milessabin milessabin requested a review from adriaanm January 17, 2018 22:23
@milessabin milessabin modified the milestones: 2.13.0-M4, 2.13.0-M3 Jan 17, 2018
@adriaanm adriaanm merged commit 4503ad2 into scala:2.13.x Jan 24, 2018
lrytz added a commit to lrytz/scala that referenced this pull request Jan 25, 2018
Race condition in the merges of
scala#6270 (added the test)
and
scala#5310 (changes its output).
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.

3 participants