diff options
author | Martin Odersky <odersky@gmail.com> | 2017-04-04 18:31:52 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-04-04 18:31:52 +0200 |
commit | a46f4f840a456bb70ef4b95e6b18608522075442 (patch) | |
tree | 5a03fc0160085ccc87a8bdf75064af2f05eb023a /tests | |
parent | 1c79612c57af81acec2480bef56240dcf5ec30d1 (diff) | |
download | dotty-a46f4f840a456bb70ef4b95e6b18608522075442.tar.gz dotty-a46f4f840a456bb70ef4b95e6b18608522075442.tar.bz2 dotty-a46f4f840a456bb70ef4b95e6b18608522075442.zip |
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.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/neg/enums.scala | 13 |
1 files changed, 12 insertions, 1 deletions
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 +} |