aboutsummaryrefslogtreecommitdiff
path: root/tests/neg/i1050c.scala
blob: ecfaa3ea382b062e22dcf96409521a987bf565c7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// i1050 checks failing at typer
object Import {
    trait A { type L <: Nothing }
    trait B { type L >: Any}
    trait U {
      lazy val p: B
      locally { val x: p.L = ??? } // old-error: nonfinal lazy
      locally {
        import p._ // error: Import.B(U.this.p) is not a legal path
        val x: L = ??? // old-error: nonfinal lazy
      }
    }
}
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 V { // error: cannot be instantiated
  type Y >: Any <: Nothing  // old-error: only classes can have declared but undefined members
  type Z
}
object Tiark5 {
    trait A { type L <: Nothing }
    trait B { type L >: Any }
    def f(x: => A & B)(y: Any):Nothing = (y:x.L) // error: underlying conflicting bounds
    f(???)("boom!")
}
object Tiark5Inherited {
    trait A { type L <: Nothing }
    trait B { type L >: Any }
    trait A2 extends A
    trait B2 extends B
    def f(x: => A2 & B2)(y: Any):Nothing = (y:x.L) // error: underlying conflicting bounds
    f(???)("boom!")
}
object Tiark7 {
    trait A { type L <: Nothing }
    trait B { type L >: Any }
    def f(x: => B)(y: Any):x.L = y // error: x is not stable
    def f1(x: => A & B)(y: Any):Nothing = f(x)(y) // error: type mismatch
    f1(???)("boom!"): Nothing
}