From a46f4f840a456bb70ef4b95e6b18608522075442 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 4 Apr 2017 18:31:52 +0200 Subject: Infer enum type args from type parameter bounds Infer type arguments for enum paraments from corresponding type parameter bounds. This only works if the type parameter in question is variant and its bound is ground. --- tests/neg/enums.scala | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/neg/enums.scala b/tests/neg/enums.scala index d6f75e2b9..1ed3007e7 100644 --- a/tests/neg/enums.scala +++ b/tests/neg/enums.scala @@ -1,9 +1,20 @@ enum List[+T] { case Cons(x: T, xs: List[T]) - case Nil // error: illegal enum value case Snoc[U](xs: List[U], x: U) // error: case with type parameters needs extends clause } enum class X { case Y // error: case not allowed here } + +enum E1[T] { + case C +} + +enum E2[+T, +U >: T] { + case C +} + +enum E3[-T <: Ordered[T]] { + case C +} -- cgit v1.2.3