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 m2-oss/calypso - rhs of a given with type bounded param unable to resolve certain other givens #19407

Closed
jchyb opened this issue Jan 10, 2024 · 2 comments · Fixed by #19411
Assignees
Labels
area:implicits related to implicits itype:bug regression This worked in a previous version but doesn't anymore

Comments

@jchyb
Copy link
Contributor

jchyb commented Jan 10, 2024

Compiler version

3.4.0-RC1-bin-20240104-2746ee8-NIGHTLY (last successful build 3.4.0-RC1-bin-20231207-16f1680-NIGHTLY), via the community build: https://github.com/VirtusLab/community-build3/actions/runs/7427597656/job/20238015937

Minimized code

trait GeneratedEnum
trait Decoder[A]

object Decoder:
  given Decoder[Int] = ???

object GeneratedEnumDecoder:

  given [A <: GeneratedEnum]: Decoder[A] =
    summon[Decoder[Int]]
    ???

Output

[error] -- [E172] Type Error: /Users/jchyb/Documents/workspace/calypso/modules/scalapb/src/main/scala/ru/m2/calypso/scalapb/GeneratedEnumDecoder.scala:10:24 
[error] 10 |    summon[Decoder[Int]]
[error]    |                        ^
[error]    |No given instance of type Decoder[Int] was found for parameter x of method summon in object Predef.
[error]    |I found:
[error]    |
[error]    |    GeneratedEnumDecoder.given_Decoder_A[A]
[error]    |
[error]    |But given instance given_Decoder_A in object GeneratedEnumDecoder does not match type Decoder[Int].
[error] one error found

Expectation

no errors

@jchyb jchyb added itype:bug area:implicits related to implicits regression This worked in a previous version but doesn't anymore labels Jan 10, 2024
@odersky
Copy link
Contributor

odersky commented Jan 10, 2024

What happens here is that the given in DeneratedDecoder itself is picked as the resolved instance. The whole problem is solved with #19392 but one has to compile with -source future.

It seems what happens is that previously the given in GeneratedEnumDecoder was rejected since Int does not conform to GeneratedEnum. But maybe now the bounds are not checked eagerly (I am only guessing). Can we get a bisect that shows where things go wrong?

@odersky
Copy link
Contributor

odersky commented Jan 10, 2024

It's actually #19392 that broke it. I.e. it now works with -source future, but not now. I'll look into it.

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.

2 participants