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 ist-dsi/scala-neutron-client - incorrect subtyping test in implicit resolution #19404

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

Comments

@jchyb
Copy link
Contributor

jchyb commented Jan 9, 2024

Compiler version

Based on a regression found in community build: https://github.com/VirtusLab/community-build3/actions/runs/7427557714/job/20237028592
Appears since 3.4.0-RC1-bin-20240104-2746ee8-NIGHTLY

Minimized code

given ipEncoder[IP <: IpAddress]: Encoder[IP] = Encoder[String].contramap(_.toString)

class Encoder[A] {
  final def contramap[B](f: B => A): Encoder[B] = new Encoder[B]
}

object Encoder {
  final def apply[A](implicit instance: Encoder[A]): Encoder[A] = instance
  implicit final val encodeString: Encoder[String] = new Encoder[String]
}

trait Json
trait IpAddress

Output

[error] ./regression.scala:2:64
[error] No given instance of type Encoder[String] was found for parameter instance of method apply in object Encoder.
[error] I found:
[error] 
[error]     ipEncoder[IP]
[error] 
[error] But given instance ipEncoder does not match type Encoder[String].
[error] given ipEncoder[IP <: IpAddress]: Encoder[IP] = Encoder[String].contramap(_.toString)
[error]                                                                ^

Expectation

No error, like in 3.3.1 (and pre 3.4.0-RC1-bin-20240104-2746ee8-NIGHTLY nightlies)

@jchyb jchyb added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label area:typer area:implicits related to implicits regression This worked in a previous version but doesn't anymore and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Jan 9, 2024
odersky added a commit to dotty-staging/dotty that referenced this issue Jan 10, 2024
odersky added a commit that referenced this issue Jan 11, 2024
Kordyjan pushed a commit that referenced this issue Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:implicits related to implicits area:typer 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.

1 participant