aboutsummaryrefslogblamecommitdiff
path: root/tests/neg/instantiateAbstract.scala
blob: 10eeac64d9e2165aa4e9959cfae6b605e8811057 (plain) (tree)

























                                                       
       










                                                                       

                                                                               
abstract class AA

trait TT

class A { self: B =>

}

@scala.annotation.Annotation class C // error

class B extends A() {
}

object Test {

  @scala.annotation.Annotation type T = String // error
  @scala.annotation.Annotation val x = 1 // error
  @scala.annotation.Annotation def f = 1 //error

  (1: @scala.annotation.Annotation) // error


  new AA // error

  new TT // error

  new A

// the following are OK in Typer but would be caught later in RefChecks

  new A() {}

  new AA() {}

  object O extends A

  object OO extends AA
}

// nopos-error: "A does not conform to its self type B; cannot be instantiated"