summaryrefslogtreecommitdiff
path: root/test/files/neg/t6276.scala
blob: bd0a473f71a40caa310ae2d04fd1b51bb585408f (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
object Test {
  def foo(a: Int, b: Int, c: Int) {
    class C {
      def a: Any = a // warn
      val b: Any = b // warn

      def c: Any = this.c // warn
      def d: Any = C.this.d // warn
    }

    def method {
      // method local
      def a: Any = a // warn
    }

    trait T {
      def a: Any
    }

    new T {
      // inherited return type
      def a = a // warn
    }

    // no warnings below
    new {
      def a: Any = {println(""); a}
      val b: Any = {println(""); b}
      def c(i: Int): Any = c(i - 0)
    }

    class D {
      def other: D = null
      def foo: Any = other.foo
    }

    class E {
      def foo: Any = 0
      class D extends E {
        override def foo: Any = E.this.foo
      }
    }
  }
}