Skip to content

Commit b14afef

Browse files
authored
Lint avoids revisiting Inlined.call (#24277)
Fixes #24266 Restores empty check and "already seen" check for Inlined.call sites.
1 parent 4689288 commit b14afef

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,10 @@ class CheckUnused private (phaseMode: PhaseMode, suffix: String) extends MiniPha
161161
tree.expansion.putAttachment(InlinedParameter, ())
162162
ctx
163163
override def transformInlined(tree: Inlined)(using Context): tree.type =
164-
transformAllDeep(tree.call)
164+
if !tree.call.isEmpty then
165+
if !refInfos.calls.containsKey(tree.call) then
166+
refInfos.calls.put(tree.call, ())
167+
transformAllDeep(tree.call)
165168
tree
166169

167170
override def prepareForBind(tree: Bind)(using Context): Context =
@@ -518,6 +521,7 @@ object CheckUnused:
518521
val asss = mutable.Set.empty[Symbol] // targets of assignment
519522
val skip = mutable.Set.empty[Symbol] // methods to skip (don't warn about their params)
520523
val nowarn = mutable.Set.empty[Symbol] // marked @nowarn
524+
val calls = new IdentityHashMap[Tree, Unit] // inlined call already seen
521525
val imps = new IdentityHashMap[Import, Unit] // imports
522526
val sels = new IdentityHashMap[ImportSelector, Unit] // matched selectors
523527
def register(tree: Tree)(using Context): Unit = if tree.srcPos.isUserCode then

0 commit comments

Comments
 (0)