@@ -2993,26 +2993,28 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
29932993 }
29942994 }
29952995 nestedCtx.typerState.commit()
2996- if sourceVersion.isAtLeast(future) then
2997- lazy val (prefix, suffix) = res match {
2998- case Block (mdef @ DefDef (_, vparams :: Nil , _, _) :: Nil , _ : Closure ) =>
2999- val arity = vparams.length
3000- if (arity > 0 ) (" " , " " ) else (" (() => " , " ())" )
3001- case _ =>
3002- (" (() => " , " )" )
3003- }
3004- def remedy =
3005- if ((prefix ++ suffix).isEmpty) " simply leave out the trailing ` _`"
3006- else s " use ` $prefix<function> $suffix` instead "
3007- report.errorOrMigrationWarning(
3008- em """ The syntax `<function> _` is no longer supported;
3009- |you can $remedy""" ,
3010- tree.srcPos,
3011- from = future)
3012- if sourceVersion.isMigrating then
3013- patch(Span (tree.span.start), prefix)
3014- patch(Span (qual.span.end, tree.span.end), suffix)
3015- end if
2996+
2997+ lazy val (prefix, suffix) = res match {
2998+ case Block (mdef @ DefDef (_, vparams :: Nil , _, _) :: Nil , _ : Closure ) =>
2999+ val arity = vparams.length
3000+ if (arity > 0 ) (" " , " " ) else (" (() => " , " ())" )
3001+ case _ =>
3002+ (" (() => " , " )" )
3003+ }
3004+ def remedy =
3005+ if ((prefix ++ suffix).isEmpty) " simply leave out the trailing ` _`"
3006+ else s " use ` $prefix<function> $suffix` instead "
3007+ def rewrite = Message .rewriteNotice(" This construct" , `3.4-migration`)
3008+ report.gradualErrorOrMigrationWarning(
3009+ em """ The syntax `<function> _` is no longer supported;
3010+ |you can $remedy$rewrite""" ,
3011+ tree.srcPos,
3012+ warnFrom = `3.4`,
3013+ errorFrom = future)
3014+ if sourceVersion.isMigrating && sourceVersion.isAtLeast(`3.4-migration`) then
3015+ patch(Span (tree.span.start), prefix)
3016+ patch(Span (qual.span.end, tree.span.end), suffix)
3017+
30163018 res
30173019 }
30183020
0 commit comments