summaryrefslogtreecommitdiff
path: root/test/files/run/t7817.scala
blob: 905b8aeb09d60fdefff25e1df4e1a12b5087de88 (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
import language.reflectiveCalls

package test {
  class C1 {
    object O {
      def struct(s: {def foo: Any}) = s.foo
    }
  }
  trait T {
    object O {
      def struct(s: {def foo: Any}) = s.foo
    }
  }
  object O1 extends T

  object O2 {
    object O {
      def struct(s: {def foo: Any}) = s.foo
    }
  }
}

object Test extends App {
  object fooable { def foo = "foo" }
  def check(result: Any) = assert(result == "foo", result.toString)

  val s = new test.C1
  check(s.O.struct(fooable))
  check(test.O1.O.struct(fooable))
  check(test.O2.O.struct(fooable))
}