From eeeb92c3d59de611dec1782a969b86171454de40 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Thu, 22 Jan 2015 10:34:17 +1000 Subject: SI-9110 Pattern `O.C` must check `$outer eq O` for a top level O The outer check was not being generated when the prefix was a top level module. The enclosed test shows that we in fact must synthesize the outer check in that case. Perhaps the bug was introduced by neglecting to consider that a module can inherit member classes. --- test/files/run/t9110.scala | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 test/files/run/t9110.scala (limited to 'test/files') diff --git a/test/files/run/t9110.scala b/test/files/run/t9110.scala new file mode 100644 index 0000000000..660291a4d1 --- /dev/null +++ b/test/files/run/t9110.scala @@ -0,0 +1,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")) + } +} -- cgit v1.2.3