summaryrefslogtreecommitdiff
path: root/test/files/run/t9110.scala
blob: 660291a4d13997f816a33ec2de6a68be3ec095c6 (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
trait Event

trait Domain {
  case class Created(name: String) extends Event
}

// declare three instances of Domain trait, one here and two
// in an inner scope

object DomainC extends Domain

object Test {
 def main(args: Array[String]) {
   object DomainA extends Domain
   object DomainB extends Domain

   def lookingForAs(event: Event): Unit = {
      event match {
        case DomainB.Created(_) => throw null
        case DomainC.Created(_) => throw null
        case DomainA.Created(_) => // okay
      }
   }

   lookingForAs(DomainA.Created("I am an A"))
  }
}