-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
area:match-typesarea:typeritype:bugregressionThis worked in a previous version but doesn't anymoreThis worked in a previous version but doesn't anymore
Milestone
Description
Compiler version
3.4.0-RC4
Minimized code
object Repro {
trait Responsive {
type Response
}
object Responsive {
type Aux[R] = Responsive {type Response = R}
type Response[R] = R match {case Aux[r] => r}
}
case class StringRequest(name: String) extends Responsive {
type Response = String
}
def withImplicit[R <: Responsive](request: R)(implicit ct: scala.reflect.ClassTag[Responsive.Response[R]]): Responsive.Response[R] = ???
def withFunction[R <: Responsive](request: R)(call: R => Responsive.Response[R]): Responsive.Response[R] = ???
def stringWithFunction(req: StringRequest): String = withFunction(req)(_.getClass.getSimpleName)
def stringWithImplicit(req: StringRequest): String = withImplicit(req)
def main(args: Array[String]): Unit = {}
}
Output
[error] -- [E007] Type Mismatch Error: /Projects/Scala3/src/main/scala/Main.scala:105:73
[error] 105 | def stringWithFunction(req: StringRequest): String = withFunction(req)(_.getClass.getSimpleName)
[error] | ^^^^^^^^^^^^^^^^^^^^^^^^
[error] | Found: Repro.StringRequest => String
[error] | Required: Repro.StringRequest =>
[error] | Repro.Responsive.Response[
[error] | Repro.StringRequest]
[error] |
[error] | longer explanation available when compiling with `-explain`
[error] -- [E172] Type Error: /Projects/Scala3/src/main/scala/Main.scala:107:72
[error] 107 | def stringWithImplicit(req: StringRequest): String = withImplicit(req)
[error] | ^
[error] |No ClassTag available for Repro.Responsive.Response[
[error] | Repro.StringRequest]
[error] two errors found
[error] (Compile / compileIncremental) Compilation failed
Expectation
Hello, decided to try out Scala 3.4.0-RC4 inside my project and found some strange behavior, this works on 3.3.1 and on 3.3.2-RC3.
If I explicitly fill the generic parameter error goes away.
Is this something that is already covered by existing issues or is this something new?
Metadata
Metadata
Assignees
Labels
area:match-typesarea:typeritype:bugregressionThis worked in a previous version but doesn't anymoreThis worked in a previous version but doesn't anymore