aboutsummaryrefslogtreecommitdiff
path: root/tests/neg/instantiateAbstract.scala
blob: a2ff38ef43dafb58ddb1b7105f66a21179a8c0e8 (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
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"