Skip to content

Commit 02cd651

Browse files
committed
Nowarn public implicit val class params
1 parent b2b0115 commit 02cd651

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

compiler/src/dotty/tools/dotc/transform/CheckUnused.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ object CheckUnused:
585585
val alias = m.owner.info.member(sym.name)
586586
if alias.exists then
587587
val aliasSym = alias.symbol
588-
if aliasSym.is(ParamAccessor) && !infos.refs(alias.symbol) then
588+
if aliasSym.isAllOf(PrivateParamAccessor, butNot = CaseAccessor) && !infos.refs(alias.symbol) then
589589
warnAt(pos)(UnusedSymbol.implicitParams)
590590
else
591591
warnAt(pos)(UnusedSymbol.implicitParams)

tests/warn/i15503f.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,7 @@ object Unmatched:
5252
case Ident(name) =>
5353
case _ =>
5454
e
55+
56+
trait Ctx
57+
case class K(i: Int)(using val ctx: Ctx) // nowarn
58+
class L(val i: Int)(using val ctx: Ctx) // nowarn

0 commit comments

Comments
 (0)