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 diff --git a/compiler/src/dotty/tools/dotc/transform/PostTyper.scala b/compiler/src/dotty/tools/dotc/transform/PostTyper.scala index e5eb03c24cd4..6d5175bf17a0 100644 --- a/compiler/src/dotty/tools/dotc/transform/PostTyper.scala +++ b/compiler/src/dotty/tools/dotc/transform/PostTyper.scala @@ -369,10 +369,7 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase case UnApply(fun, implicits, patterns) => // Reverse transform order for the same reason as in `app1` above. val patterns1 = transform(patterns) - val tree1 = cpy.UnApply(tree)(transform(fun), transform(implicits), patterns1) - // The pickling of UnApply trees uses the tpe of the tree, - // so we need to clean retains from it here - tree1.withType(transformAnnotsIn(CleanupRetains()(tree1.tpe))) + cpy.UnApply(tree)(transform(fun), transform(implicits), patterns1) case tree: TypeApply => if tree.symbol == defn.QuotedTypeModule_of then ctx.compilationUnit.needsStaging = true diff --git a/tests/pos-custom-args/captures/i24207.scala b/tests/pos-custom-args/captures/i24207.scala deleted file mode 100644 index 075b42315a3c..000000000000 --- a/tests/pos-custom-args/captures/i24207.scala +++ /dev/null @@ -1,14 +0,0 @@ -import language.experimental.captureChecking - -class Generator: - private def generateTable(table: Table) = - val (ownRelations, _) = calculateOwnRelations(table) - ownRelations - - private def calculateOwnRelations(table: Table) = - val ownRelations = table.relations.filter(_.association.isDefined) - (ownRelations, Nil) - -case class Table(relations: Seq[TableRelation]) -case class TableRelation(association: Option[Association]) -trait Association diff --git a/tests/warn/i24263.scala b/tests/warn/i24263.scala deleted file mode 100644 index fc4768de2597..000000000000 --- a/tests/warn/i24263.scala +++ /dev/null @@ -1,6 +0,0 @@ -//> using options -Werror -Wunused:all - -object test { - def f(t: Tuple): Nothing = ??? - val _ = (inputTuple: NamedTuple.NamedTuple[Tuple, Tuple]) => f(inputTuple) -}