Skip to content

Commit 38b7923

Browse files
committed
Remove unnecessary warining
All splices at level -1 or lower are now caught by typer
1 parent cb15a69 commit 38b7923

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

compiler/src/dotty/tools/dotc/transform/PCPCheckAndHeal.scala

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,15 @@ 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+
assert(level >= 0)
58+
val body1 = transform(body)(spliceContext)
59+
splice match {
60+
case Apply(fun: TypeApply, _) if splice.isTerm =>
61+
// Type of the splice itsel must also be healed
62+
// internal.Quoted.expr[F[T]](... T ...) --> internal.Quoted.expr[F[$t]](... T ...)
63+
val tp = checkType(splice.sourcePos).apply(splice.tpe.widenTermRefExpr)
64+
cpy.Apply(splice)(cpy.TypeApply(fun)(fun.fun, tpd.TypeTree(tp) :: Nil), body1 :: Nil)
65+
case splice: Select => cpy.Select(splice)(body1, splice.name)
7066
}
7167
}
7268

0 commit comments

Comments
 (0)