Created
December 19, 2017 11:15
-
-
Save crater2150/73824328b4cc005a631a706623a8ccc0 to your computer and use it in GitHub Desktop.
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
trait Element[+R] | |
class NullElement[+R] extends Element[R] | |
trait BugRepro { | |
def combineElements(actions: Element[_]*): Element[Unit] | |
def sequence[R, M[+_] <: TraversableOnce[_]](in: M[Element[R]]): Element[M[R]] | |
val mySeq = Seq(1,2,3) | |
// bugRepro.scala:13: error: inferred type arguments [Nothing,Any] do not conform to method sequence's type parameter bounds [R,M[+_] <: TraversableOnce[_]] | |
// sequence(mySeq.map(i => new NullElement[Int])) | |
// ^ | |
// bugRepro.scala:13: error: type mismatch; | |
// found : Any | |
// required: M[Element[R]] | |
// sequence(mySeq.map(i => new NullElement[Int])) | |
def typeError = { | |
combineElements( | |
sequence(mySeq.map(_ => new NullElement[Int])) | |
) | |
} | |
// compiles fine, although equivalent to above code | |
def compiles = { | |
val outlined = mySeq.map(_ => new NullElement[Int]) | |
combineElements( | |
sequence(outlined) | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment