Skip to content

Fix #5833: Refine condition what constitutes an IFT in adapt #5841

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 6, 2019

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Feb 4, 2019

No description provided.

@biboudis
Copy link
Contributor

biboudis commented Feb 5, 2019

Before LGTMing I was wondering if the following is valid code. I took the first one and introduced Entry. By refining the return type of the context query based on it (once directly and one via tha parameter) I get the following error:

trait Entry { type Key; val key: Key }

class NarrowDependentDT[E <: Entry]{
  def x: given (e: E) => e.Key = ???
  def y: given (e: Entry) => e.Key = x
}
22 |  def y: given (e: Entry) => e.Key = x
   |                                      ^
   |                                 no implicit argument of type E was found for parameter of given (e: E) => e.Key

WDYT @odersky? Otherwise looks good.

@abgruszecki
Copy link
Contributor

@biboudis are you sure the arguments are the right way around? Your example does compile if x = y instead.

@biboudis
Copy link
Contributor

biboudis commented Feb 6, 2019

I also checked the inverse and indeed it worked. I am still confused by this however.

@odersky
Copy link
Contributor Author

odersky commented Feb 6, 2019

The error seems to be legit. x needs an E as argument, but we only have an Entry.

@biboudis biboudis merged commit 482de4e into scala:master Feb 6, 2019
@biboudis biboudis deleted the fix-#5833 branch February 6, 2019 22:27
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