diff options
Diffstat (limited to 'tests/pos/tycons.scala')
-rw-r--r-- | tests/pos/tycons.scala | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/pos/tycons.scala b/tests/pos/tycons.scala new file mode 100644 index 000000000..f138c78be --- /dev/null +++ b/tests/pos/tycons.scala @@ -0,0 +1,22 @@ +class TypeConstructor { + type TypeArg +} + +trait List[+T] extends TypeConstructor { type TypeArg <: T } + +trait Set[T] extends TypeConstructor { type TypeArg <: T } + +object obj extends List[Number] with Set[Exception] { + val x: TypeArg = ??? + val n: Number = x + val e: Exception = x +} + +class Functor[F <: TypeConstructor] { + def map[A, B](f: F { type TypeArg <: A }): F { type TypeArg <: B } +} + +implicit object ListFunctor extends Functor[List] { + def map[A, B](f: List[A]): List[B] = ??? +} + |