From 0f1e1c7d1fa7f1cabc7f8ff061d60c6b4d5937ae Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Tue, 28 Oct 2025 12:14:35 +0100 Subject: [PATCH] Exclude synthetic opaque proxy from lint (#24264) Fixes #24263 [Cherry-picked 55f235c61f6a8bf76ef69c3778b972f0ecd6a881][modified] --- compiler/src/dotty/tools/dotc/transform/CheckUnused.scala | 2 +- tests/warn/i24263.scala | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 tests/warn/i24263.scala diff --git a/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala b/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala index 21515695f2e6..b4098ef24221 100644 --- a/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala +++ b/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala @@ -642,7 +642,7 @@ object CheckUnused: def checkLocal(sym: Symbol, pos: SrcPos) = if ctx.settings.WunusedHas.locals - && !sym.is(InlineProxy) + && !sym.isOneOf(InlineProxy | Synthetic) && !sym.isCanEqual then if sym.is(Mutable) && infos.asss(sym) then diff --git a/tests/warn/i24263.scala b/tests/warn/i24263.scala new file mode 100644 index 000000000000..fc4768de2597 --- /dev/null +++ b/tests/warn/i24263.scala @@ -0,0 +1,6 @@ +//> using options -Werror -Wunused:all + +object test { + def f(t: Tuple): Nothing = ??? + val _ = (inputTuple: NamedTuple.NamedTuple[Tuple, Tuple]) => f(inputTuple) +}