diff options
Diffstat (limited to 'tests/neg/i1050.scala')
-rw-r--r-- | tests/neg/i1050.scala | 62 |
1 files changed, 60 insertions, 2 deletions
diff --git a/tests/neg/i1050.scala b/tests/neg/i1050.scala index 48e2b5f2e..bc906f4f4 100644 --- a/tests/neg/i1050.scala +++ b/tests/neg/i1050.scala @@ -2,7 +2,7 @@ trait A { type L <: Nothing } trait B { type L >: Any} object Test { lazy val x: A & B = ??? - val y: x.L = 1 + val y: x.L = 1 // error: underlying conflicting bounds val z: String = y } object Test50 { @@ -14,7 +14,7 @@ object Test50 { } lazy val o: A & B = ??? - def xToString(x: o.X): String = x + def xToString(x: o.X): String = x // error: underlying conflicting bounds def intToString(i: Int): String = xToString(i) @@ -22,3 +22,61 @@ object Test50 { val s: String = intToString(1) } } +object Test2 { + + trait C { type A } + + type T = C { type A = Any } + type U = C { type A = Nothing } + type X = T & U + + def main(args: Array[String]) = { + val y: X#A = 1 // error: conflicting bounds + val z: String = y + } +} +object Tiark1 { + trait A { type L <: Nothing } + trait B { type L >: Any} + trait U { + val p: B + def brand(x: Any): p.L = x // error: not final + } + trait V extends U { + lazy val p: A & B = ??? + } + val v = new V {} + v.brand("boom!") +} +object Tiark2 { + trait A { type L <: Nothing } + trait B { type L >: Any} + trait U { + type X <: B + val p: X + def brand(x: Any): p.L = x // error: not final + } + trait V extends U { + type X = B & A + lazy val p: X = ??? + } + val v = new V {} + v.brand("boom!"): Nothing +} +/* +object Import { + trait A { type L <: Nothing } + trait B { type L >: Any} + trait U { + val p: B + def brand(x: Any): p.L = x // error: not final + locally { import p._ + } + } + trait V extends U { + lazy val p: A & B = ??? + } + val v = new V {} + v.brand("boom!") +} +*/ |