Closed xuwei-k closed 3 months ago
This is the use case for -Wmacros:after
.
But that will warn in this case for unused $m
:
def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Tree = {
val $u: U = $m$untyped.universe;
val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
$u.Literal.apply($u.Constant.apply(()))
}
I would expect that to be synthetic and not warnable. (reify(a)
would use $m
.)
You can see both warnings with -Wmacros:both
.
The missing mode is "collect definitions before expansion, but collect usages both before and after". Notably, that would skip cruft in the expansion.
The current usage is to fiddle with -Wmacros
, but the PR adds the missing mode as default
so that only references (and not definitions) in the expansion contribute to reducing false positives.
Reproduction steps
Scala version: 2.13.12
build.sbt
A.scala
Problem
buf compile error if remove
Unliftable[A]