summaryrefslogtreecommitdiff
path: root/test/files/pos/t7377/Macro_1.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-04-17 09:19:21 +0200
committerJason Zaugg <jzaugg@gmail.com>2013-04-17 13:05:08 +0200
commit15e9ef8f083e0c0dc75bf51a0784f56df2e2bea8 (patch)
tree4ace5c078ce2931263b5de50de77377faa3da778 /test/files/pos/t7377/Macro_1.scala
parent4525e9223a2fb7c1ec3014073566b559e5839805 (diff)
downloadscala-15e9ef8f083e0c0dc75bf51a0784f56df2e2bea8.tar.gz
scala-15e9ef8f083e0c0dc75bf51a0784f56df2e2bea8.tar.bz2
scala-15e9ef8f083e0c0dc75bf51a0784f56df2e2bea8.zip
SI-7377 Fix retypechecking of patterns on case companion alias
Some ancient code in Typers switches from PATTERNmode to EXPRmode when encountering `stableF(...)`. It just typechecks `stableF` and discards the arguments. To the best of Martin's recollection, this has something to do with the need to typecheck patterns rather late in the compiler, after `a.b` had been translated to `a.b()` in `Uncurry`. I'm not able to motivate this with tests using `-Xoldpatmat`; was there ever an even older pattern matcher that ran *after* uncurry? What changed in 2.10.1 to expose this wrinkle? dfbaaa17 fixed `TypeTree.copyAttrs` to copy the original tree. During the descent of `ResetAttrs`, sub-trees are duplicated before begin further transformed. Duplicating the `Match` in 2.10.0 would forget that the original tree of: pat = (a: Int)Foo(_) `----------` `- TypeTree((a: Int)Foo), with original Select(..., "FooAlias") The retypechecking would operate on the `MethodType`, rather than the `Select`, which was not considered a stable application. For 2.10.x, I've just tightened up the condition to only hit this if `args` is empty. I'm almost certain that the code can be removed altogether, and I'll do that when this is merged to master.
Diffstat (limited to 'test/files/pos/t7377/Macro_1.scala')
-rw-r--r--test/files/pos/t7377/Macro_1.scala7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/files/pos/t7377/Macro_1.scala b/test/files/pos/t7377/Macro_1.scala
new file mode 100644
index 0000000000..a0ec1d84af
--- /dev/null
+++ b/test/files/pos/t7377/Macro_1.scala
@@ -0,0 +1,7 @@
+import language.experimental._
+import reflect.macros.Context
+
+object M {
+ def noopImpl[A](c: Context)(expr: c.Expr[A]): c.Expr[A] = c.Expr(c.typeCheck(c.resetLocalAttrs(expr.tree)))
+ def noop[A](expr: A): A = macro noopImpl[A]
+}