summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Namers.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-08-13 21:04:27 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-08-14 09:44:08 +0200
commitf783d0b16b41641b07ca76c03ad2f25a80ff8f2b (patch)
treed93f8db9fe569f585214a424c783a24c00b808bb /src/compiler/scala/tools/nsc/typechecker/Namers.scala
parent46aab7b8d77d275aad0686b11214ee1a0d62e941 (diff)
downloadscala-f783d0b16b41641b07ca76c03ad2f25a80ff8f2b.tar.gz
scala-f783d0b16b41641b07ca76c03ad2f25a80ff8f2b.tar.bz2
scala-f783d0b16b41641b07ca76c03ad2f25a80ff8f2b.zip
accommodated the feedback for the pull request
For the discussion see: https://github.com/scala/scala/pull/1101
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Namers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index efb96b173c..92d0d4e228 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -988,6 +988,15 @@ trait Namers extends MethodSynthesis {
// (either "macro ???" as they used to or just "???" to maximally simplify their compilation)
if (fastTrack contains ddef.symbol) ddef.symbol setFlag MACRO
+ // macro defs need to be typechecked in advance
+ // because @macroImpl annotation only gets assigned during typechecking
+ // otherwise macro defs wouldn't be able to robustly coexist with their clients
+ // because a client could be typechecked before a macro def that it uses
+ if (ddef.symbol.isTermMacro) {
+ val pt = resultPt.substSym(tparamSyms, tparams map (_.symbol))
+ typer.computeMacroDefType(ddef, pt)
+ }
+
thisMethodType({
val rt = (
if (!tpt.isEmpty) {