-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport "Better types for class type parameters" (#16046)
Backports #15951
- Loading branch information
Showing
3 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
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) // error |