Skip to content

Commit 30127f0

Browse files
som-snyttWojciechMazur
authored andcommitted
Lint avoids revisiting Inlined.call (#24277)
Fixes #24266 Restores empty check and "already seen" check for Inlined.call sites. [Cherry-picked b14afef]
1 parent b4e531e commit 30127f0

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
@@ -141,7 +141,10 @@ class CheckUnused private (phaseMode: PhaseMode, suffix: String) extends MiniPha
141141
tree
142142

143143
override def transformInlined(tree: Inlined)(using Context): tree.type =
144-
transformAllDeep(tree.call)
144+
if !tree.call.isEmpty then
145+
if !refInfos.calls.containsKey(tree.call) then
146+
refInfos.calls.put(tree.call, ())
147+
transformAllDeep(tree.call)
145148
tree
146149

147150
override def prepareForBind(tree: Bind)(using Context): Context =
@@ -425,6 +428,7 @@ object CheckUnused:
425428
val asss = mutable.Set.empty[Symbol] // targets of assignment
426429
val skip = mutable.Set.empty[Symbol] // methods to skip (don't warn about their params)
427430
val nowarn = mutable.Set.empty[Symbol] // marked @nowarn
431+
val calls = new IdentityHashMap[Tree, Unit] // inlined call already seen
428432
val imps = new IdentityHashMap[Import, Unit] // imports
429433
val sels = new IdentityHashMap[ImportSelector, Unit] // matched selectors
430434
def register(tree: Tree)(using Context): Unit = if tree.srcPos.isUserCode then

0 commit comments

Comments
 (0)