File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -582,11 +582,11 @@ object CheckUnused:
582582 warnAt(pos)(UnusedSymbol .privateMembers)
583583 else if ctx.settings.WunusedHas .explicits
584584 && ! sym.is(Synthetic ) // param to setter is unused bc there is no field yet
585- && ! (sym.owner.is(ExtensionMethod ) && {
586- m.paramSymss.dropWhile(_.exists(_.isTypeParam)) match
587- case (h :: Nil ) :: Nil => h == sym // param is the extended receiver
585+ && ! (sym.owner.is(ExtensionMethod ) &&
586+ m.paramSymss.dropWhile(_.exists(_.isTypeParam)). match
587+ case (h :: Nil ) :: _ => h == sym // param is the extended receiver
588588 case _ => false
589- } )
589+ )
590590 && ! sym.name.isInstanceOf [DerivedName ]
591591 && ! ctx.platform.isMainMethod(m)
592592 then
Original file line number Diff line number Diff line change 1+ //> using options -Wunused:explicits
2+
3+ // An external class that doesn't get its own `copy` method.
4+ class Foo (val a : String , val b : Int )
5+
6+ //
7+ // Example 1: add `copy` method via an extension method.
8+ //
9+ extension (self : Foo )
10+ def copy (a : String = self.a, b : Int = self.b): Foo = Foo (a, b) // nowarn
11+
12+ //
13+ // Example 2: implement `copyFoo` with parameter groups.
14+ //
15+ def copyFoo (foo : Foo )(a : String = foo.a, b : Int = foo.b): Foo = Foo (a, b) // warn
You can’t perform that action at this time.
0 commit comments