summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Namers.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2013-12-07 12:36:25 +0100
committerEugene Burmako <xeno.by@gmail.com>2013-12-30 19:06:29 +0300
commit9e14058dd246b7e9d93c4fd4e4aab326d45460d6 (patch)
tree4282e87dae44cd671683f41dd563bd12e6784228 /src/compiler/scala/tools/nsc/typechecker/Namers.scala
parent9737b808c12821162e2a5888b17175a396037f50 (diff)
downloadscala-9e14058dd246b7e9d93c4fd4e4aab326d45460d6.tar.gz
scala-9e14058dd246b7e9d93c4fd4e4aab326d45460d6.tar.bz2
scala-9e14058dd246b7e9d93c4fd4e4aab326d45460d6.zip
gives a more specific signature to `computeMacroDefType`
I guess having `computeMacroDefType` is the remnant from the times when we considered an immediate possibility of having non-defdef macros, for instance type macros, which would be TypeDefs. These happy early days are gone, type macros have been long buried, and the perspectives of extensions to the existing def macro scheme are unclear. Therefore let’s have maximally precise types right away and then think of generalization later on, once/if we get there.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Namers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 39e259fdfd..a30198e949 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -828,9 +828,10 @@ trait Namers extends MethodSynthesis {
* assigns the type to the tpt's node. Returns the type.
*/
private def assignTypeToTree(tree: ValOrDefDef, defnTyper: Typer, pt: Type): Type = {
- val rhsTpe =
- if (tree.symbol.isTermMacro) defnTyper.computeMacroDefType(tree, pt)
- else defnTyper.computeType(tree.rhs, pt)
+ val rhsTpe = tree match {
+ case ddef: DefDef if tree.symbol.isTermMacro => defnTyper.computeMacroDefType(ddef, pt)
+ case _ => defnTyper.computeType(tree.rhs, pt)
+ }
val defnTpe = widenIfNecessary(tree.symbol, rhsTpe, pt)
tree.tpt defineType defnTpe setPos tree.pos.focus