aboutsummaryrefslogblamecommitdiff
path: root/tests/neg/selfInheritance.scala
blob: 073316de008c491d6f3cf8345c8464e850a1adfb (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13












                             
                                                                                                                         
 
                                                                                                                         




             
                                                                                                                                        
 
                                                                                                                                        
 
                                                                                                                                        

 
 
                                                                                                                                    

                      
trait T { self: B => }

abstract class A { self: B =>

}

class B extends A with T {
}

class C { self: B =>

}

class D extends A // error: illegal inheritance: self type D of class D does not conform to self type B of parent class A

class E extends T // error: illegal inheritance: self type E of class E does not conform to self type B of parent trait T

object Test {

  new B() {}

  new A() {} // error: illegal inheritance: self type A{...} of anonymous class A{...} does not conform to self type B of parent class A

  object O extends A // error: illegal inheritance: self type Test.O.type of object O$ does not conform to self type B of parent class A

  object M extends C // error: illegal inheritance: self type Test.M.type of object M$ does not conform to self type B of parent class C

}

trait X { self: Y => } // error: missing requirement: self type Y & X of trait X does not conform to self type Z of required trait Y
trait Y { self: Z => }
trait Z