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

Regression in implicit params lookup of recursive calls #15820

Closed
WojciechMazur opened this issue Aug 4, 2022 · 2 comments · Fixed by #16001
Closed

Regression in implicit params lookup of recursive calls #15820

WojciechMazur opened this issue Aug 4, 2022 · 2 comments · Fixed by #16001
Labels
area:implicits related to implicits itype:bug regression This worked in a previous version but doesn't anymore
Milestone

Comments

@WojciechMazur
Copy link
Contributor

Based on Open CB #2105

Compiler version

Works in 3.1.1
Fails since 3.1.2
Fails in 3.2.0-RC3

Minimized code

sealed trait Domain[E]

final def splitBounds[E, D[X] <: Domain[X]](
    bounds: Seq[E],
  )( using domain: D[E]): Seq[E] =
      val newBounds: Seq[E] = ???
      splitBounds(newBounds) // does not compile
      splitBounds[E,D](newBounds) // does compile

Output

[error] ./test.scala:7:29: no given instance of type D[E] was found for parameter domain of method splitBounds
[error] 
[error] where:    D is a type variable with constraint <: Domain
[error]       splitBounds(newBounds) // does not compile
[error]         

Expectation

Should compile by resuing implicit Domain parameter

@WojciechMazur WojciechMazur added itype:bug area:implicits related to implicits regression This worked in a previous version but doesn't anymore labels Aug 4, 2022
@KacperFKorban
Copy link
Member

I think that this is an intended change #15670 (comment)

@odersky
Copy link
Contributor

odersky commented Aug 11, 2022

Yes, it's intended.

@odersky odersky closed this as completed Aug 11, 2022
@Kordyjan Kordyjan closed this as not planned Won't fix, can't repro, duplicate, stale Aug 12, 2022
smarter added a commit that referenced this issue Sep 9, 2022
)

Two improvements for implicit searches involving type variables.

1. We now always add a comment when an implicit search is rejected due
to the "too unspecific" criterion of #13886, commit
[Refine checking for underspecified implicit
queries](db5956b).

There have been quite a few regressions that hit that problem, so it is
good to know immediately what
   the issue is. 

2. There is now a better wildcard approximation of higher-kinded type
applications. This makes several programs (including original #15998)
compile, which were classified as not specific enough before.

Fixes #15998
Fixes #15820
Fixes #15670
Fixes #15160 
Fixes #13986
@Kordyjan Kordyjan added this to the 3.2.2 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:implicits related to implicits itype:bug regression This worked in a previous version but doesn't anymore
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants