Created
March 22, 2013 15:19
-
-
Save milessabin/5222090 to your computer and use it in GitHub Desktop.
Scala 2.9.x bug
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
// With -Ydependent-method-types | |
// Compiles with 2.10.x | |
scala> trait Algebra[F[_]] { trait Expr[A] } | |
defined trait Algebra | |
scala> trait ClosedExpr { def apply[F[_], A](algebra: Algebra[F]): algebra.Expr[A] } | |
defined trait ClosedExpr | |
scala> new ClosedExpr { def apply[F[_], A](algebra: Algebra[F]): algebra.Expr[A] = new algebra.Expr[A] {} } | |
<console>:10: error: can't existentially abstract over parameterized type F | |
new ClosedExpr { def apply[F[_], A](algebra: Algebra[F]): algebra.Expr[A] = new algebra.Expr[A] {} } | |
^ | |
scala> class Foo extends ClosedExpr { def apply[F[_], A](algebra: Algebra[F]): algebra.Expr[A] = new algebra.Expr[A] {} } | |
<console>:9: error: overriding method apply in trait ClosedExpr of type [F[_], A](algebra: Algebra[F])algebra.Expr[A]; | |
method apply has incompatible type | |
class Foo extends ClosedExpr { def apply[F[_], A](algebra: Algebra[F]): algebra.Expr[A] = new algebra.Expr[A] {} } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment