aboutsummaryrefslogtreecommitdiff
path: root/tests/untried/pos/infersingle.scala
diff options
context:
space:
mode:
authorSamuel Gruetter <samuel.gruetter@epfl.ch>2014-03-12 22:44:33 +0100
committerSamuel Gruetter <samuel.gruetter@epfl.ch>2014-03-12 22:44:33 +0100
commit9ef5f6817688f814a3450126aa7383b0928e80a0 (patch)
tree5727a2f7f7fd665cefdb312af2785c692f04377c /tests/untried/pos/infersingle.scala
parent194be919664447631ba55446eb4874979c908d27 (diff)
downloaddotty-9ef5f6817688f814a3450126aa7383b0928e80a0.tar.gz
dotty-9ef5f6817688f814a3450126aa7383b0928e80a0.tar.bz2
dotty-9ef5f6817688f814a3450126aa7383b0928e80a0.zip
add tests from scala/test/files/{pos,neg}
with explicit Unit return type
Diffstat (limited to 'tests/untried/pos/infersingle.scala')
-rw-r--r--tests/untried/pos/infersingle.scala52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/untried/pos/infersingle.scala b/tests/untried/pos/infersingle.scala
new file mode 100644
index 000000000..60f4ff07e
--- /dev/null
+++ b/tests/untried/pos/infersingle.scala
@@ -0,0 +1,52 @@
+object Test1 {
+ def one[T](x: T): Option[T] = Some(x)
+ val x = "one"
+ val y: Option[x.type] = one(x)
+}
+
+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
+ }
+}