summaryrefslogtreecommitdiff
path: root/test/files/pos/t7853-partial-function.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-09-18 11:18:28 +0200
committerJason Zaugg <jzaugg@gmail.com>2013-09-18 11:34:39 +0200
commit0f67e8dddcb8b087560fed90339d9235179dd1ea (patch)
tree9a5b92b7139215faf0c3efb5bf48314116db3abb /test/files/pos/t7853-partial-function.scala
parent746f53e0cee601c189dac7a011f5be79591ece4c (diff)
downloadscala-0f67e8dddcb8b087560fed90339d9235179dd1ea.tar.gz
scala-0f67e8dddcb8b087560fed90339d9235179dd1ea.tar.bz2
scala-0f67e8dddcb8b087560fed90339d9235179dd1ea.zip
SI-7853 A less ad-hoc place to call memberType
Rather than localizing the fix to the outerAccessor, this commit pushed the call to `memberType` into *all* usages of `newValDef` and `newDefDef`. The TPT of `applyOrElse` in synthetized partial functions must be set explicitly to pass the pos/t7853-partial-function.scala. Otherwise, the as-seen-from ends up cloning the type parameter `B1` of `applyOrElse` as it transforms (questionably) its bound from `List[Int @unchecked]` to `List[Int]`. Partial Function synthesis was already a delicate area, and this makes things more explicit which could be counted as an improvement.
Diffstat (limited to 'test/files/pos/t7853-partial-function.scala')
-rw-r--r--test/files/pos/t7853-partial-function.scala7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/files/pos/t7853-partial-function.scala b/test/files/pos/t7853-partial-function.scala
new file mode 100644
index 0000000000..b09254e99a
--- /dev/null
+++ b/test/files/pos/t7853-partial-function.scala
@@ -0,0 +1,7 @@
+object Test {
+
+ def testCons: Unit = {
+ def x[A](a: PartialFunction[Any, A]): A = a(0)
+ val eval0 = x { case list: List[Int @unchecked] => list }
+ }
+}