- Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
area:typeritype:bugregressionThis worked in a previous version but doesn't anymoreThis worked in a previous version but doesn't anymore
Milestone
Description
Compiler version
Fails in 3.2.0
Fails in 3.2.1-RC1-bin-20220830-8504b8d-NIGHTLY
Compiles with 3.1.3
Minimized code
object Ops: implicit class EitherSeqOps[E, T](private val seq: Seq[Either[E, T]]) extends AnyVal: def sequence: Either[::[E], Seq[T]] = ??? trait BuildException case class CompositeBuildException(ex: ::[BuildException]) extends BuildException trait ActionableDiagnostic trait ActionableHandler[A <: ActionableDiagnostic]: def exec: Either[BuildException, Seq[A]] import Ops._ val test: Either[BuildException, Seq[ActionableDiagnostic]] = // Can be replaced with Seq[Either[BuildException, Seq[ _ <: ActionableDiagnostic]]] , but current version matches better type of missing implicit Seq.empty[ActionableHandler[_]].map(_.exec) .sequence .left.map(_.head) .map(_.flatten) // errorDirty workaround:
Seq.empty[ActionableHandler[_]].map(_.exec) .sequence .left.map(_.head) .map{ (v: Seq[Seq[Any]]) => v.flatten } .asInstanceOf[Either[BuildException, Seq[ActionableDiagnostic]]] would also work for Seq.empty[ActionableHandler[_ <: ActionableDiagnostic]].map(_.exec)
Output
[error] ./test.scala:21:19: [error] No given instance of type Seq[Any] => IterableOnce[B] was found for parameter asIterable of method flatten in trait IterableOps [error] where: B is a type variable with constraint <: ActionableDiagnostic [error] .map(_.flatten) // error [error] Expectation
Should compile
Metadata
Metadata
Assignees
Labels
area:typeritype:bugregressionThis worked in a previous version but doesn't anymoreThis worked in a previous version but doesn't anymore