summaryrefslogtreecommitdiff
path: root/test/files/pos/infersingle.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-09-15 04:19:11 -0700
committerJason Zaugg <jzaugg@gmail.com>2013-09-15 04:19:11 -0700
commitf3d9bdc283a82b816218aefc3df7d287e0cdd271 (patch)
tree6d0cc6fa3b80e099f61b0bb97a996b8987d38a10 /test/files/pos/infersingle.scala
parentcb5519a539b6af7b0312f059ab6d7d94b759dae2 (diff)
parent330ead53be9569f0069be5f6ab62d82cd7c8367f (diff)
downloadscala-f3d9bdc283a82b816218aefc3df7d287e0cdd271.tar.gz
scala-f3d9bdc283a82b816218aefc3df7d287e0cdd271.tar.bz2
scala-f3d9bdc283a82b816218aefc3df7d287e0cdd271.zip
Merge pull request #2931 from paulp/pr/TreeDSL
Reducing variation of tree creation methods.
Diffstat (limited to 'test/files/pos/infersingle.scala')
-rw-r--r--test/files/pos/infersingle.scala51
1 files changed, 49 insertions, 2 deletions
diff --git a/test/files/pos/infersingle.scala b/test/files/pos/infersingle.scala
index 6830fcd799..60f4ff07e6 100644
--- a/test/files/pos/infersingle.scala
+++ b/test/files/pos/infersingle.scala
@@ -1,5 +1,52 @@
-object Test {
+object Test1 {
def one[T](x: T): Option[T] = Some(x)
val x = "one"
val y: Option[x.type] = one(x)
-} \ No newline at end of file
+}
+
+object Test2 {
+ // Has never worked, but seems desirable given the recent changes to
+ // pattern type inference.
+ val a = ""
+ object Id {
+ def unapply(xxxx: Any): Some[a.type] = Some[a.type](a)
+ }
+ val b: a.type = (a: a.type) match {
+ case Id(x) => x
+ }
+}
+
+object Test3 {
+ val a = ""
+ object Id {
+ def unapply(xxxx: Any): Some[Test3.type] = Some[Test3.type](Test3)
+ }
+ val b: Test3.type = a match {
+ case Id(x) => x
+ }
+}
+
+class Test4 {
+ val a = ""
+ object Id {
+ def unapply(xxxx: Any): Some[Test4.this.type] = Some[Test4.this.type](Test4.this)
+ }
+ val b: Test4.this.type = a match {
+ case Id(x) => x
+ }
+}
+
+class Super5 {
+ final val q = ""
+ def q1: q.type = q
+}
+
+class Test5 extends Super5 {
+ val a = ""
+ object Id {
+ def unapply(xxxx: Any): Some[Test5.super.q.type] = Some[Test5.super.q.type](q1)
+ }
+ val b: Test5.super.q.type = a match {
+ case Id(x) => x
+ }
+}