summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorJames Iry <jamesiry@gmail.com>2013-08-16 08:22:15 -0700
committerJames Iry <jamesiry@gmail.com>2013-08-16 08:22:15 -0700
commitab8021f4d997f792ba4aabef4e6c8968a1ae78cc (patch)
tree05df1d2c9e1cb94ef7d538c32ab5a733e7bb1cb7 /src/compiler
parent8053c197941608b06089de4a618615d46552aa0b (diff)
parent75b44a6f723762cc3ebc911483beb2aec4cfee78 (diff)
downloadscala-ab8021f4d997f792ba4aabef4e6c8968a1ae78cc.tar.gz
scala-ab8021f4d997f792ba4aabef4e6c8968a1ae78cc.tar.bz2
scala-ab8021f4d997f792ba4aabef4e6c8968a1ae78cc.zip
Merge pull request #2814 from xeno-by/topic/auto-duplicate-expansions
[nomaster] macro expansions are now auto-duplicated
Diffstat (limited to 'src/compiler')
-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 816f977890..d6ec5f2cb0 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
@@ -713,9 +713,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()
}