diff options
author | liu fengyun <liu@fengy.me> | 2016-12-07 23:09:06 +0100 |
---|---|---|
committer | liu fengyun <liu@fengy.me> | 2016-12-08 19:11:41 +0100 |
commit | 072af0012ac10b5d24d91954911825be543a6517 (patch) | |
tree | a434737c579ab161464af6e0db3c829ce420746b /compiler/src | |
parent | 9ceed9213497597de8895c83bdf0cc4d5597b150 (diff) | |
download | dotty-072af0012ac10b5d24d91954911825be543a6517.tar.gz dotty-072af0012ac10b5d24d91954911825be543a6517.tar.bz2 dotty-072af0012ac10b5d24d91954911825be543a6517.zip |
fix #1773: handle patterns in interpolated string
Diffstat (limited to 'compiler/src')
-rw-r--r-- | compiler/src/dotty/tools/dotc/ast/Desugar.scala | 6 |
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) |