summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-05-09 15:13:09 -0700
committerPaul Phillips <paulp@improving.org>2012-05-09 16:07:35 -0700
commit09f380dbda56abdfbdda0cab51bc7187eb70b516 (patch)
tree91058c6990817313b9e25503af0b36f4ad5efbda /test
parent1cd498f9091504b42030d4b81c6f659bc386115f (diff)
downloadscala-09f380dbda56abdfbdda0cab51bc7187eb70b516.tar.gz
scala-09f380dbda56abdfbdda0cab51bc7187eb70b516.tar.bz2
scala-09f380dbda56abdfbdda0cab51bc7187eb70b516.zip
Fix an inference regression with this.type.
Closes SI-5210.
Diffstat (limited to 'test')
-rw-r--r--test/files/pos/t5210.scala10
-rw-r--r--test/pending/pos/z1720.scala16
2 files changed, 26 insertions, 0 deletions
diff --git a/test/files/pos/t5210.scala b/test/files/pos/t5210.scala
new file mode 100644
index 0000000000..e85037a902
--- /dev/null
+++ b/test/files/pos/t5210.scala
@@ -0,0 +1,10 @@
+object WithOpTest {
+ trait WithOp extends Cloneable {
+ def f: this.type = this
+ def g1: this.type = f
+ def g2: this.type = {
+ val t = f
+ t
+ }
+ }
+}
diff --git a/test/pending/pos/z1720.scala b/test/pending/pos/z1720.scala
new file mode 100644
index 0000000000..6050f3ff88
--- /dev/null
+++ b/test/pending/pos/z1720.scala
@@ -0,0 +1,16 @@
+package test
+
+class Thing {
+ def info: Info[this.type] = InfoRepository.getInfo(this)
+ def info2: Info[this.type] = {
+ def self: this.type = this
+ InfoRepository.getInfo(self)
+ }
+}
+
+trait Info[T]
+case class InfoImpl[T](thing: T) extends Info[T]
+
+object InfoRepository {
+ def getInfo(t: Thing): Info[t.type] = InfoImpl(t)
+} \ No newline at end of file