Skip to content

Commit a5e72c2

Browse files
som-snytttgodzik
authored andcommitted
Lint avoids revisiting Inlined.call (scala#24277)
Fixes scala#24266 Restores empty check and "already seen" check for Inlined.call sites. [Cherry-picked b14afef]
1 parent 245c4ea commit a5e72c2

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
@@ -166,7 +166,10 @@ class CheckUnused private (phaseMode: PhaseMode, suffix: String) extends MiniPha
166166
tree.expansion.putAttachment(InlinedParameter, ())
167167
ctx
168168
override def transformInlined(tree: Inlined)(using Context): tree.type =
169-
transformAllDeep(tree.call)
169+
if !tree.call.isEmpty then
170+
if !refInfos.calls.containsKey(tree.call) then
171+
refInfos.calls.put(tree.call, ())
172+
transformAllDeep(tree.call)
170173
tree
171174

172175
override def prepareForBind(tree: Bind)(using Context): Context =
@@ -491,6 +494,7 @@ object CheckUnused:
491494
val asss = mutable.Set.empty[Symbol] // targets of assignment
492495
val skip = mutable.Set.empty[Symbol] // methods to skip (don't warn about their params)
493496
val nowarn = mutable.Set.empty[Symbol] // marked @nowarn
497+
val calls = new IdentityHashMap[Tree, Unit] // inlined call already seen
494498
val imps = new IdentityHashMap[Import, Unit] // imports
495499
val sels = new IdentityHashMap[ImportSelector, Unit] // matched selectors
496500
def register(tree: Tree)(using Context): Unit = if tree.srcPos.isUserCode then

0 commit comments

Comments
 (0)