diff options
author | Martin Odersky <odersky@gmail.com> | 2016-02-01 00:08:26 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-02-09 09:43:07 +0100 |
commit | defba2af7c3b49231962a6f882173bcaff914fcc (patch) | |
tree | 16149a87ac1422d5eac51e4e563f56eda743562c /tests | |
parent | 3637e08033c857e19862ae1fc9730d96cdba3fe2 (diff) | |
download | dotty-defba2af7c3b49231962a6f882173bcaff914fcc.tar.gz dotty-defba2af7c3b49231962a6f882173bcaff914fcc.tar.bz2 dotty-defba2af7c3b49231962a6f882173bcaff914fcc.zip |
Check that non-abstract classes have realizable bounds.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/neg/i1050.scala | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/tests/neg/i1050.scala b/tests/neg/i1050.scala index 25e647a57..5808011fa 100644 --- a/tests/neg/i1050.scala +++ b/tests/neg/i1050.scala @@ -79,6 +79,21 @@ object Tiark3 { val v = new V {} v.brand("boom!"): Nothing } +object Tiark4 { + trait U { + type Y + trait X { type L = Y } + def compute: X + final lazy val p: X = compute + def brand(x: Y): p.L = x + } + trait V extends U { + type Y >: Any <: Nothing + def compute: X = ??? + } + val v = new V {} // error: cannot be instantiated + v.brand("boom!") +} object Import { trait A { type L <: Nothing } trait B { type L >: Any} @@ -90,7 +105,7 @@ object Import { val x: L = ??? // error: nonfinal lazy } } - trait V extends U { - lazy val p: A & B = ??? } - +object V { // error: cannot be instantiated + type Y >: Any <: Nothing // error: only classes can have declared but undefined members +} |