From 5f72cc333b6f7da5794c2429730ef511a20cc22f Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Tue, 2 Jul 2019 15:59:26 +0200 Subject: [PATCH] Cleanup unnecessary blocks created for type tags in pickled quotes --- compiler/src/dotty/tools/dotc/core/quoted/PickledQuotes.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/dotc/core/quoted/PickledQuotes.scala b/compiler/src/dotty/tools/dotc/core/quoted/PickledQuotes.scala index 42160f6a5355..d33a8580e560 100644 --- a/compiler/src/dotty/tools/dotc/core/quoted/PickledQuotes.scala +++ b/compiler/src/dotty/tools/dotc/core/quoted/PickledQuotes.scala @@ -38,7 +38,9 @@ object PickledQuotes { /** Force unpickling of the tree, removes the spliced type `@quotedTypeTag type` definitions and dealiases references to `@quotedTypeTag type` */ val forceAndCleanArtefacts = new TreeMap { override def transform(tree: tpd.Tree)(implicit ctx: Context): tpd.Tree = tree match { - case tree: TypeDef if tree.symbol.hasAnnotation(defn.InternalQuoted_QuoteTypeTagAnnot) => Thicket() + case Block(stat :: rest, expr1) if stat.symbol.hasAnnotation(defn.InternalQuoted_QuoteTypeTagAnnot) => + assert(rest.forall { case tdef: TypeDef => tdef.symbol.hasAnnotation(defn.InternalQuoted_QuoteTypeTagAnnot) }) + transform(expr1) case tree => super.transform(tree).withType(dealiasTypeTags(tree.tpe)) } }