File tree 2 files changed +9
-14
lines changed
compiler/src/dotty/tools/dotc 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(
54
54
* - If inside of a macro definition, check the validity of the macro.
55
55
*/
56
56
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)
70
65
}
71
66
}
72
67
Original file line number Diff line number Diff line change @@ -2263,7 +2263,7 @@ class Typer extends Namer
2263
2263
ctx.error(" Splice ${...} outside quotes '{...} or inline method" , tree.sourcePos)
2264
2264
else if (level < 0 )
2265
2265
ctx.error(
2266
- """ Splice ${...} at level -1 .
2266
+ s """ Splice $$ {...} at level $level .
2267
2267
|
2268
2268
|Inline method may contain a splice at level 0 but the contents of this splice cannot have a splice.
2269
2269
| """ .stripMargin, tree.sourcePos
You can’t perform that action at this time.
0 commit comments