Last active
January 30, 2017 10:38
-
-
Save mandubian/3039cf0b4ed98d2126d20ca806d890aa 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 X[A <: AnyKind, F[_ <: AnyKind]] { type B = F[A] } | |
// OK | |
val i5: X[Option, ({ type l[X[_]] = X[Int] })#l]#B = Some(5) | |
///////////////////////////////////////////////////////////// | |
// KO | |
val i1: X[Option, List]#B = Some(5) | |
// Error Before Patch | |
kind-poly14.scala:45: error: type mismatch; | |
found : Some[Int] | |
required: List[Option] | |
val i: X[Option, List]#B = Some(5) ^ | |
// Now | |
kind-poly14.scala:45: error: [Kind-Polymorphic Error] X[Option, List]#B inferred to type List[Option] with illegal kind type argument Option applied to type List[A] | |
val i: X[Option, List]#B = Some(5) | |
^ | |
///////////////////////////////////////////////////////////// | |
val j: X[Double, ({ type l[X[_]] = X[Int] })#l]#B = 5.0 | |
// Before Patch | |
error: null | |
// Now | |
kind-poly14.scala:51: error: [Kind-Polymorphic Error] X[Double, scala.AnyRef { | |
type l[X[_] >: [_]Nothing <: [_]Any] = X[Int] | |
}#l]#B inferred to type Double[Int] with illegal kind type argument Int applied to type Double | |
val j: X[Double, ({ type l[X[_]] = X[Int] })#l]#B = 5.0 | |
^ | |
///////////////////////////////////////////////////////////// | |
// KO | |
val i0: X[Option, Double]#B = Some(5) | |
// Error | |
kind-poly14.scala:48: error: Double takes no type parameters, expected: one | |
val i0: X[Option, Double]#B = Some(5) | |
^ | |
///////////////////////////////////////////////////////////// | |
// KO | |
val i1: X[Option, List]#B = Some(5) | |
// Error | |
kind-poly14.scala:51: error: [Kind-Polymorphic Error] X[Option, List]#B inferred to type List[Option] with illegally kinded type arguments Option applied to type List[A] | |
val i1: X[Option, List]#B = Some(5) | |
^ | |
///////////////////////////////////////////////////////////// | |
// KO | |
val i3: X[Option[Double], ({ type l[X[_]] = X[Int] })#l]#B = Some(5) | |
// Error | |
kind-poly14.scala:54: error: type mismatch; | |
found : Some[Int] | |
required: List[Option[Double]] | |
val i2: X[Option[Double], List]#B = Some(5) | |
^ | |
///////////////////////////////////////////////////////////// | |
// KO | |
val i4: X[Double, ({ type l[X[_]] = X[Int] })#l]#B = 5.0 | |
// ERROR | |
kind-poly14.scala:60: error: [Kind-Polymorphic Error] X[Double, scala.AnyRef { | |
type l[X[_] >: [_]Nothing <: [_]Any] = X[Int] | |
}#l]#B inferred to type Double[Int] with illegally kinded type arguments Int applied to type Double | |
val i4: X[Double, ({ type l[X[_]] = X[Int] })#l]#B = 5.0 | |
^ | |
///////////////////////////////////////////////////////////// | |
// KO | |
val i6: X[Either, ({ type l[X[_]] = X[Int] })#l]#B = Some(5) | |
// ERROR | |
kind-poly14.scala:66: error: [Kind-Polymorphism Error] Invalid inferred kind-polymorphic type Either[Int] | |
trying to apply bad number(1) of arguments [Int] to type Either[A,B] | |
val i6: X[Either, ({ type l[X[_]] = X[Int] })#l]#B = Some(5) | |
^ | |
///////////////////////////////////////////////////////////// | |
// KO | |
val i7: X[Either, List]#B = Some(5) | |
// ERROR | |
kind-poly14.scala:69: error: [Kind-Polymorphic Error] X[Either, List]#B inferred to type List[[+A, +B]scala.util.Either[A,B]] | |
with illegally kinded type arguments [+A, +B]scala.util.Either[A,B] applied to type List[A] | |
val i7: X[Either, List]#B = Some(5) | |
^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment