summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2011-11-28 13:55:31 +0000
committerMartin Odersky <odersky@gmail.com>2011-11-28 13:55:31 +0000
commitf69d3e34dd165eb0f3242fcba3e6bbdc3d61e5d1 (patch)
tree3bd46bb86b0227420d7074553dae68ab16b080f2 /src/compiler/scala/tools/nsc/typechecker/Typers.scala
parent4e987a3cf032eb176c20bf3fd5ac847a73b19c00 (diff)
downloadscala-f69d3e34dd165eb0f3242fcba3e6bbdc3d61e5d1.tar.gz
scala-f69d3e34dd165eb0f3242fcba3e6bbdc3d61e5d1.tar.bz2
scala-f69d3e34dd165eb0f3242fcba3e6bbdc3d61e5d1.zip
Revised macro defs, added a test case.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index f9c056e16d..b969e9629f 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -1676,7 +1676,6 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser {
*/
def typedDefDef(ddef: DefDef): DefDef = {
val meth = ddef.symbol.initialize
- if (meth.isMacro) return ddef
reenterTypeParams(ddef.tparams)
reenterValueParams(ddef.vparamss)
@@ -1712,6 +1711,8 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser {
meth.owner.isAnonOrRefinementClass))
error(ddef.pos, "constructor definition not allowed here")
typed(ddef.rhs)
+ } else if (meth.isMacro) {
+ EmptyTree
} else {
transformedOrTyped(ddef.rhs, EXPRmode, tpt1.tpe)
}
@@ -3444,7 +3445,7 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser {
// (calling typed1 more than once for the same tree)
if (checked ne res) typed { atPos(tree.pos)(checked) }
else res
- } else if (fun2.hasSymbol && fun2.symbol.isMacro)
+ } else if ((mode & FUNmode) == 0 && fun2.hasSymbol && fun2.symbol.isMacro)
typed1(macroExpand(res), mode, pt)
else
res