-
Notifications
You must be signed in to change notification settings - Fork 1.1k
More careful ClassTag instantiation #23659
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
Conversation
We now use a blend of the new scheme and backwards compatible special case if type variables as ClassTag arguments are constrained by further type variables. Fixes scala#23611
I've tried it on community build, but the zio project is still failing - I've figured out that the reproducer was missing an important part - the [error] ./example.scala:52:7
[error] Found: ZStream[Any, Throwable, java.io.File]
[error] Required: ZStream[Any, java.io.IOException, java.io.File]
Error compiling project (Scala 3.8.0-RC1-bin-20250805-2b604c5, JVM (21)) Below there's a full reproducer: import java.io.{File, IOException}
import java.net.URI
import java.nio.file.{Path, Paths}
import scala.reflect.ClassTag
trait FileConnectors {
def listPath(path: => Path): ZStream[Any, IOException, Path]
final def listFile(file: => File): ZStream[Any, IOException, File] =
for {
path <- null.asInstanceOf[ZStream[Any, IOException, Path]]
r <- listPath(path).mapZIO(a => ZIO.attempt(a.toFile).refineToOrDie)
} yield r
}
sealed abstract class CanFail[-E]
object CanFail:
given [E]: CanFail[E] = ???
sealed trait ZIO[-R, +E, +A]
extension [R, E <: Throwable, A](self: ZIO[R, E, A])
def refineToOrDie[E1 <: E: ClassTag](using CanFail[E]): ZIO[R, E1, A] = ???
object ZIO:
def attempt[A](code: => A): ZIO[Any, Throwable, A] = ???
sealed trait ZStream[-R, +E, +A]:
def map[B](f: A => B): ZStream[R, E, B] = ???
def flatMap[R1 <: R, E1 >: E, B](f: A => ZStream[R1, E1, B]): ZStream[R1, E1, B]
def mapZIO[R1 <: R, E1 >: E, A1](f: A => ZIO[R1, E1, A1]): ZStream[R1, E1, A1] |
The latest minimization also compiles now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, fixes the zio-archive/zio-connect
build, but does not resolve erikerlandson/coulomb
issues yet
We now use a blend of the new scheme and a backwards compatible special case if type variables as ClassTag arguments are constrained by further type variables.
Fixes #23611