From 5d0d8342736cf773830f2a9498c4e84bdef8593d Mon Sep 17 00:00:00 2001 From: som-snytt Date: Tue, 28 Oct 2025 03:36:32 -0700 Subject: [PATCH] Lint avoids revisiting Inlined.call (#24277) Fixes #24266 Restores empty check and "already seen" check for Inlined.call sites. --- compiler/src/dotty/tools/dotc/transform/CheckUnused.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala b/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala index 3378ce06f848..b1d3c2d4438b 100644 --- a/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala +++ b/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala @@ -166,7 +166,10 @@ class CheckUnused private (phaseMode: PhaseMode, suffix: String) extends MiniPha tree.expansion.putAttachment(InlinedParameter, ()) ctx override def transformInlined(tree: Inlined)(using Context): tree.type = - transformAllDeep(tree.call) + if !tree.call.isEmpty then + if !refInfos.calls.containsKey(tree.call) then + refInfos.calls.put(tree.call, ()) + transformAllDeep(tree.call) tree override def prepareForBind(tree: Bind)(using Context): Context = @@ -491,6 +494,7 @@ object CheckUnused: val asss = mutable.Set.empty[Symbol] // targets of assignment val skip = mutable.Set.empty[Symbol] // methods to skip (don't warn about their params) val nowarn = mutable.Set.empty[Symbol] // marked @nowarn + val calls = new IdentityHashMap[Tree, Unit] // inlined call already seen val imps = new IdentityHashMap[Import, Unit] // imports val sels = new IdentityHashMap[ImportSelector, Unit] // matched selectors def register(tree: Tree)(using Context): Unit = if tree.srcPos.isUserCode then