summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2015-01-22 10:34:17 +1000
committerJason Zaugg <jzaugg@gmail.com>2015-11-26 22:34:28 +1000
commiteeeb92c3d59de611dec1782a969b86171454de40 (patch)
treeb36417943cc498e682e9eb0e402bcae06985f4fa /test/files
parent2ef93ad2fe29766fbe09a3e921ad361b25abdeaf (diff)
downloadscala-eeeb92c3d59de611dec1782a969b86171454de40.tar.gz
scala-eeeb92c3d59de611dec1782a969b86171454de40.tar.bz2
scala-eeeb92c3d59de611dec1782a969b86171454de40.zip
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.
Diffstat (limited to 'test/files')
-rw-r--r--test/files/run/t9110.scala27
1 files changed, 27 insertions, 0 deletions
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"))
+ }
+}