File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -742,13 +742,13 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
742
742
val spliceTypeText = (keywordStr(" [" ) ~ toTextGlobal(tree.typeOpt) ~ keywordStr(" ]" )).provided(printDebug && tree.typeOpt.exists)
743
743
keywordStr(" $" ) ~ spliceTypeText ~ keywordStr(" {" ) ~ toTextGlobal(expr) ~ keywordStr(" }" )
744
744
case tree @ QuotePattern (bindings, body, quotes) =>
745
- // TODO print quotes for debugging
745
+ val quotesText = (keywordStr( " < " ) ~ toText( quotes) ~ keywordStr( " > " )).provided(printDebug)
746
746
val bindingsText = bindings.map(binding => {
747
747
keywordStr(" type " ) ~ toText(binding.symbol.name) ~ toText(binding.symbol.info) ~ " ; "
748
748
}).reduceLeft(_ ~~ _).provided(bindings.nonEmpty)
749
749
val open = if (body.isTerm) keywordStr(" {" ) else keywordStr(" [" )
750
750
val close = if (body.isTerm) keywordStr(" }" ) else keywordStr(" ]" )
751
- keywordStr(" '" ) ~ open ~ bindingsText ~ toTextGlobal(body) ~ close
751
+ keywordStr(" '" ) ~ quotesText ~ open ~ bindingsText ~ toTextGlobal(body) ~ close
752
752
case SplicePattern (pattern, args) =>
753
753
val spliceTypeText = (keywordStr(" [" ) ~ toTextGlobal(tree.typeOpt) ~ keywordStr(" ]" )).provided(printDebug && tree.typeOpt.exists)
754
754
keywordStr(" $" ) ~ spliceTypeText ~ {
Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ class ReTyper(nestingLevel: Int = 0) extends Typer(nestingLevel) with ReChecking
114
114
override def typedQuotePattern (tree : untpd.QuotePattern , pt : Type )(using Context ): Tree =
115
115
assertTyped(tree)
116
116
val bindings1 = tree.bindings.map(typed(_))
117
- val bodyCtx = quoteContext.retractMode(Mode .Pattern )// .addMode(Mode.QuotedPattern)
117
+ val bodyCtx = quoteContext.retractMode(Mode .Pattern ).addMode(Mode .QuotedPattern )
118
118
val body1 = typed(tree.body, tree.bodyType)(using bodyCtx)
119
119
val quotes1 = typed(tree.quotes, defn.QuotesClass .typeRef)
120
120
untpd.cpy.QuotePattern (tree)(bindings1, body1, quotes1).withType(tree.typeOpt)
@@ -126,7 +126,7 @@ class ReTyper(nestingLevel: Int = 0) extends Typer(nestingLevel) with ReChecking
126
126
val patternTpe =
127
127
if args1.isEmpty then tree.typeOpt
128
128
else defn.FunctionType (args1.size).appliedTo(args1.map(_.tpe) :+ tree.typeOpt)
129
- val bodyCtx = spliceContext.addMode(Mode .Pattern )
129
+ val bodyCtx = spliceContext.addMode(Mode .Pattern ).retractMode( Mode . QuotedPattern )
130
130
val body1 = typed(tree.body, defn.QuotedExprClass .typeRef.appliedTo(patternTpe))(using bodyCtx)
131
131
val args = tree.args.mapconserve(typedExpr(_))
132
132
untpd.cpy.SplicePattern (tree)(body1, args1).withType(tree.typeOpt)
You can’t perform that action at this time.
0 commit comments