diff options
author | liu fengyun <liu@fengy.me> | 2017-01-30 02:34:16 +0100 |
---|---|---|
committer | liu fengyun <liu@fengy.me> | 2017-01-30 02:34:36 +0100 |
commit | 1231dd5abc0bd42403f5386460de2026e678e88b (patch) | |
tree | 3ce6ff4599f635c46caaaaddbaf11cc1013841ca /compiler/test/dotty/tools/dotc | |
parent | 6e8933ccc40bbfe1a92c32c2d8314fd6facef12a (diff) | |
download | dotty-1231dd5abc0bd42403f5386460de2026e678e88b.tar.gz dotty-1231dd5abc0bd42403f5386460de2026e678e88b.tar.bz2 dotty-1231dd5abc0bd42403f5386460de2026e678e88b.zip |
fix incorrect flatten of thicket inside interpolated string in UntpdTreeMap
Diffstat (limited to 'compiler/test/dotty/tools/dotc')
-rw-r--r-- | compiler/test/dotty/tools/dotc/ast/UntypedTreeMapTest.scala | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/compiler/test/dotty/tools/dotc/ast/UntypedTreeMapTest.scala b/compiler/test/dotty/tools/dotc/ast/UntypedTreeMapTest.scala new file mode 100644 index 000000000..9e7402968 --- /dev/null +++ b/compiler/test/dotty/tools/dotc/ast/UntypedTreeMapTest.scala @@ -0,0 +1,32 @@ +package dotty.tools +package dotc +package ast + +import org.junit.Test +import org.junit.Assert._ + +import dotc.core.Contexts._ +import dotc.parsing.Parsers.Parser +import dotc.util.SourceFile + +class UntpdTreeMapTest extends DottyTest { + + import untpd._ + + def parse(code: String): Tree = { + val (_, stats) = new Parser(new SourceFile("<meta>", code.toCharArray)).templateStatSeq() + stats match { case List(stat) => stat; case stats => untpd.Thicket(stats) } + } + + @Test + def testMapInterpolatedString = { + val tree = parse(""" q"hello ${2017}!" """) + val identity = new UntypedTreeMap { + override def transform(tree: Tree)(implicit ctx: Context): Tree = tree match { + case _ => super.transform(tree) + } + } + + assertEquals(tree.toString, identity.transform(tree).toString) + } +} |