aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools
diff options
context:
space:
mode:
authorliu fengyun <liufengyunchina@gmail.com>2016-12-08 19:43:44 +0100
committerGitHub <noreply@github.com>2016-12-08 19:43:44 +0100
commitac160ea20dc3a18cad33484286cb3e37e9fe1171 (patch)
treea4333c83ef1f9a13322ccda0c8394563dcedf84c /compiler/src/dotty/tools
parent9fcc0a2b818feea2f6205fe1fe27cdc4e518bcbd (diff)
parent072af0012ac10b5d24d91954911825be543a6517 (diff)
downloaddotty-ac160ea20dc3a18cad33484286cb3e37e9fe1171.tar.gz
dotty-ac160ea20dc3a18cad33484286cb3e37e9fe1171.tar.bz2
dotty-ac160ea20dc3a18cad33484286cb3e37e9fe1171.zip
Merge pull request #1778 from dotty-staging/fix-i1773
Fix #1773: handle patterns in interpolated string
Diffstat (limited to 'compiler/src/dotty/tools')
-rw-r--r--compiler/src/dotty/tools/dotc/ast/Desugar.scala6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/src/dotty/tools/dotc/ast/Desugar.scala b/compiler/src/dotty/tools/dotc/ast/Desugar.scala
index c8b1ed909..7f25d6b0c 100644
--- a/compiler/src/dotty/tools/dotc/ast/Desugar.scala
+++ b/compiler/src/dotty/tools/dotc/ast/Desugar.scala
@@ -916,7 +916,11 @@ object desugar {
val elems = segments flatMap {
case ts: Thicket => ts.trees.tail
case t => Nil
+ } map {
+ case Block(Nil, expr) => expr // important for interpolated string as patterns, see i1773.scala
+ case t => t
}
+
Apply(Select(Apply(Ident(nme.StringContext), strs), id), elems)
case InfixOp(l, op, r) =>
if (ctx.mode is Mode.Type)
@@ -1081,6 +1085,8 @@ object desugar {
trees foreach collect
case Thicket(trees) =>
trees foreach collect
+ case Block(Nil, expr) =>
+ collect(expr)
case _ =>
}
collect(tree)