summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Macros.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-12-29 05:22:31 -0800
committerEugene Burmako <xeno.by@gmail.com>2012-12-29 05:22:31 -0800
commit26c27d831db5d68c4b65c0f1eb6d7286798814b5 (patch)
treecb8fd8b0144f15a4d579b79390ea58170f364f6d /src/compiler/scala/tools/nsc/typechecker/Macros.scala
parent8c7e034d528017afea18e9f345be71f7485380ee (diff)
parent48cdfefb95ee43ded08688d6c99a8c3a32d47f18 (diff)
downloadscala-26c27d831db5d68c4b65c0f1eb6d7286798814b5.tar.gz
scala-26c27d831db5d68c4b65c0f1eb6d7286798814b5.tar.bz2
scala-26c27d831db5d68c4b65c0f1eb6d7286798814b5.zip
Merge pull request #1818 from scalamacros/topic/auto-duplicate-expansions
macro expansions are now auto-duplicated
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Macros.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Macros.scala8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Macros.scala b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
index 6ed879af14..768d739b4b 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
@@ -694,9 +694,11 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces {
var expectedTpe = expandee.tpe
if (isNullaryInvocation(expandee)) expectedTpe = expectedTpe.finalResultType
- var typechecked = typecheck("macro def return type", expanded, expectedTpe)
- typechecked = typecheck("expected type", typechecked, pt)
- typechecked
+ // also see http://groups.google.com/group/scala-internals/browse_thread/thread/492560d941b315cc
+ val expanded0 = duplicateAndKeepPositions(expanded)
+ val expanded1 = typecheck("macro def return type", expanded0, expectedTpe)
+ val expanded2 = typecheck("expected type", expanded1, pt)
+ expanded2
} finally {
popMacroContext()
}