File tree Expand file tree Collapse file tree 2 files changed +9
-14
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 2 files changed +9
-14
lines changed Original file line number Diff line number Diff line change @@ -54,19 +54,14 @@ class PCPCheckAndHeal(@constructorOnly ictx: Context) extends TreeMapWithStages(
5454 * - If inside of a macro definition, check the validity of the macro.
5555 */
5656 protected def transformSplice (body : Tree , splice : Tree )(implicit ctx : Context ): Tree = {
57- if (level < 0 ) {
58- ctx.error(s " Splice at level $level is not allowed " , splice.sourcePos)
59- splice
60- } else {
61- val body1 = transform(body)(spliceContext)
62- splice match {
63- case Apply (fun : TypeApply , _) if splice.isTerm =>
64- // Type of the splice itsel must also be healed
65- // internal.Quoted.expr[F[T]](... T ...) --> internal.Quoted.expr[F[$t]](... T ...)
66- val tp = checkType(splice.sourcePos).apply(splice.tpe.widenTermRefExpr)
67- cpy.Apply (splice)(cpy.TypeApply (fun)(fun.fun, tpd.TypeTree (tp) :: Nil ), body1 :: Nil )
68- case splice : Select => cpy.Select (splice)(body1, splice.name)
69- }
57+ val body1 = transform(body)(spliceContext)
58+ splice match {
59+ case Apply (fun : TypeApply , _) if splice.isTerm =>
60+ // Type of the splice itsel must also be healed
61+ // internal.Quoted.expr[F[T]](... T ...) --> internal.Quoted.expr[F[$t]](... T ...)
62+ val tp = checkType(splice.sourcePos).apply(splice.tpe.widenTermRefExpr)
63+ cpy.Apply (splice)(cpy.TypeApply (fun)(fun.fun, tpd.TypeTree (tp) :: Nil ), body1 :: Nil )
64+ case splice : Select => cpy.Select (splice)(body1, splice.name)
7065 }
7166 }
7267
Original file line number Diff line number Diff line change @@ -2263,7 +2263,7 @@ class Typer extends Namer
22632263 ctx.error(" Splice ${...} outside quotes '{...} or inline method" , tree.sourcePos)
22642264 else if (level < 0 )
22652265 ctx.error(
2266- """ Splice ${...} at level -1 .
2266+ s """ Splice $$ {...} at level $level .
22672267 |
22682268 |Inline method may contain a splice at level 0 but the contents of this splice cannot have a splice.
22692269 | """ .stripMargin, tree.sourcePos
You can’t perform that action at this time.
0 commit comments