summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-02-28 09:16:03 -0800
committerPaul Phillips <paulp@improving.org>2012-02-28 09:49:02 -0800
commitc11ec6f532449f110c3b776b11f0b2c4398fe0f9 (patch)
tree0e5a5f13dfa53d7cdc093099b3dfe46063ae4409 /test/files
parentf3711b634ccfa6ef4ab14ffc8d12d244de6917c2 (diff)
downloadscala-c11ec6f532449f110c3b776b11f0b2c4398fe0f9.tar.gz
scala-c11ec6f532449f110c3b776b11f0b2c4398fe0f9.tar.bz2
scala-c11ec6f532449f110c3b776b11f0b2c4398fe0f9.zip
Fix for typing of objects in patterns.
An object in a pattern should have type "Foo.type" just as objects not in patterns do. Closes SI-5406. Review by @moors.
Diffstat (limited to 'test/files')
-rw-r--r--test/files/neg/t414.check2
-rw-r--r--test/files/neg/t4879.check4
-rw-r--r--test/files/pos/t5406.scala4
3 files changed, 7 insertions, 3 deletions
diff --git a/test/files/neg/t414.check b/test/files/neg/t414.check
index a855497648..d0d24baa33 100644
--- a/test/files/neg/t414.check
+++ b/test/files/neg/t414.check
@@ -1,5 +1,5 @@
t414.scala:5: error: pattern type is incompatible with expected type;
- found : object Empty
+ found : Empty.type (with underlying type object Empty)
required: IntMap[a]
Note: if you intended to match against the class, try `case _: Empty[_]` or `case Empty()`
case Empty =>
diff --git a/test/files/neg/t4879.check b/test/files/neg/t4879.check
index 49f3c73cf7..94758c751c 100644
--- a/test/files/neg/t4879.check
+++ b/test/files/neg/t4879.check
@@ -1,11 +1,11 @@
t4879.scala:6: error: pattern type is incompatible with expected type;
- found : object C
+ found : C.type (with underlying type object C)
required: C
Note: if you intended to match against the class, try `case _: C` or `case C(_)`
case C => true
^
t4879.scala:10: error: pattern type is incompatible with expected type;
- found : object D
+ found : D.type (with underlying type object D)
required: D[T,U,V]
Note: if you intended to match against the class, try `case _: D[_,_,_]` or `case D(_,_,_)`
case D => true
diff --git a/test/files/pos/t5406.scala b/test/files/pos/t5406.scala
new file mode 100644
index 0000000000..c2e42c0ac3
--- /dev/null
+++ b/test/files/pos/t5406.scala
@@ -0,0 +1,4 @@
+object Wuffles { }
+object Test {
+ def f = (Some(Wuffles): Option[Wuffles.type]) match { case Some(Wuffles) => println("Woof"); case _ => println("Meow") }
+}