summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorDenys Shabalin <denys.shabalin@typesafe.com>2014-01-30 11:39:55 +0100
committerDenys Shabalin <denys.shabalin@typesafe.com>2014-02-09 15:06:26 +0100
commita8a7f4a0e6bc418073f8b9ed43abbc96ee0141d9 (patch)
tree2f32900c107d7c93e5c5e77c88818037171ba6b9 /src/compiler
parent08e51dfec50842253afb87cc5ae3c7400dc18ced (diff)
downloadscala-a8a7f4a0e6bc418073f8b9ed43abbc96ee0141d9.tar.gz
scala-a8a7f4a0e6bc418073f8b9ed43abbc96ee0141d9.tar.bz2
scala-a8a7f4a0e6bc418073f8b9ed43abbc96ee0141d9.zip
SI-8202 bug compatibility with SI-8211 for quasiquotes
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala2
-rw-r--r--src/compiler/scala/tools/reflect/quasiquotes/Parsers.scala6
3 files changed, 9 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index e3d2bf14a0..a549fee4d9 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -2495,7 +2495,7 @@ self =>
def mkDefs(p: Tree, tp: Tree, rhs: Tree): List[Tree] = {
val trees = {
val pat = if (tp.isEmpty) p else Typed(p, tp) setPos (p.pos union tp.pos)
- gen.mkPatDef(newmods, pat, rhs)
+ makePatDef(newmods, pat, rhs)
}
if (newmods.isDeferred) {
trees match {
diff --git a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
index 525dcffb0c..6e5a3f6ef7 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
@@ -168,4 +168,6 @@ abstract class TreeBuilder {
vparamss ::: List(evidenceParams)
}
}
+
+ def makePatDef(mods: Modifiers, pat: Tree, rhs: Tree) = gen.mkPatDef(mods, pat, rhs)
}
diff --git a/src/compiler/scala/tools/reflect/quasiquotes/Parsers.scala b/src/compiler/scala/tools/reflect/quasiquotes/Parsers.scala
index fcb8734644..4bb37d8487 100644
--- a/src/compiler/scala/tools/reflect/quasiquotes/Parsers.scala
+++ b/src/compiler/scala/tools/reflect/quasiquotes/Parsers.scala
@@ -77,6 +77,12 @@ trait Parsers { self: Quasiquotes =>
// tq"$a => $b"
override def makeFunctionTypeTree(argtpes: List[Tree], restpe: Tree): Tree =
AppliedTypeTree(Ident(tpnme.QUASIQUOTE_FUNCTION), argtpes :+ restpe)
+
+ // make q"val (x: T) = rhs" be equivalent to q"val x: T = rhs" for sake of bug compatibility (SI-8211)
+ override def makePatDef(mods: Modifiers, pat: Tree, rhs: Tree) = pat match {
+ case Apply(Ident(nme.QUASIQUOTE_TUPLE), inParensPat :: Nil) => super.makePatDef(mods, inParensPat, rhs)
+ case _ => super.makePatDef(mods, pat, rhs)
+ }
}
import treeBuilder.{global => _, unit => _, _}