Skip to content

Fix #1857: Allow lower bounds to influence implicit search #3921

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
Feb 2, 2018

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jan 26, 2018

The previous implementation claimed to conform to the spec:

  We exclude lower bounds to conform to SLS 7.2:
  "The parts of a type T are: [...] if T is an abstract type, the parts of its upper bound"

But in fact we do not need to exclude lower bounds from namedPartsWith to do that -
TypeRefs are already lifted to classes, which implements SLS 7.2. Including lower bounds
does affect wildcard types (i1857.scala) and wildcard parameters in implicits (implicit-lower-bound.scala), but the spec does not exclude either of these.

The previous implementation claimed to conform to the spec:

      We exclude lower bounds to conform to SLS 7.2:
      "The parts of a type T are: [...] if T is an abstract type, the parts of its upper bound"

But in fact we do not need to exclude lower bounds from `namedPartsWith` to do that -
TypeRefs are already lifted to classes, which implements SLS 7.2. Including lower bounds
does affect wildcard types (i1857.scala) and wildcard parameters in implicits (implicit-lower-bound.scala),
but the spec does not exclude either if these.
@odersky odersky requested a review from smarter January 26, 2018 10:47
@odersky odersky changed the title Fix #1857: Allow lower bounds in to influence implicit search Fix #1857: Allow lower bounds to influence implicit search Jan 26, 2018
@odersky
Copy link
Contributor Author

odersky commented Jan 26, 2018

Test optimized hung. It's doing that a lot now. Can we find out the root cause of this?

@odersky odersky merged commit 6e6c271 into scala:master Feb 2, 2018
get1 // works
get2 // error
get1
get2
Copy link
Member

Choose a reason for hiding this comment

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

I'll note that this line doesn't compile with scalac, so scalac interpretation of SLS 7.2 seems to match what I had in mind.

@allanrenucci allanrenucci deleted the fix-#1857- branch March 19, 2018 17:17
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