File tree Expand file tree Collapse file tree 3 files changed +47
-1
lines changed
compiler/src/dotty/tools/dotc/transform
tests/neg-custom-args/fatal-warnings Expand file tree Collapse file tree 3 files changed +47
-1
lines changed Original file line number Diff line number Diff line change @@ -621,7 +621,7 @@ object CheckUnused:
621621 (sym.is(Param ) || sym.isAllOf(PrivateParamAccessor | Local , butNot = CaseAccessor )) &&
622622 ! isSyntheticMainParam(sym) &&
623623 ! sym.shouldNotReportParamOwner &&
624- (! sym.exists || ! sym.owner.isAllOf(Synthetic | PrivateLocal ))
624+ (! sym.exists || ! ( sym.owner.isAllOf(Synthetic | PrivateLocal ) || sym.owner.is( Accessor ) ))
625625
626626 private def shouldReportPrivateDef (using Context ): Boolean =
627627 currScopeType.top == ScopeType .Template && ! memDef.symbol.isConstructor && memDef.symbol.is(Private , butNot = SelfName | Synthetic | CaseAccessor )
Original file line number Diff line number Diff line change @@ -52,3 +52,6 @@ package foo.test.trivial:
5252 def f77 (x : Int ) = foo // error
5353 }
5454 object Y
55+
56+ package foo .test .i16955:
57+ class S (var r : String ) // OK
Original file line number Diff line number Diff line change @@ -126,6 +126,49 @@ package foo.test.possibleclasses:
126126 def a = k + y + s + t + z
127127 }
128128
129+ package foo .test .possibleclasses .withvar:
130+ case class AllCaseClass (
131+ k : Int , // OK
132+ private var y : Int // OK /* Kept as it can be taken from pattern */
133+ )(
134+ s : Int , // error /* But not these */
135+ var t : Int , // OK
136+ private var z : Int // error
137+ )
138+
139+ case class AllCaseUsed (
140+ k : Int , // OK
141+ private var y : Int // OK
142+ )(
143+ s : Int , // OK
144+ var t : Int , // OK
145+ private var z : Int // OK
146+ ) {
147+ def a = k + y + s + t + z
148+ }
149+
150+ class AllClass (
151+ k : Int , // error
152+ private var y : Int // error
153+ )(
154+ s : Int , // error
155+ var t : Int , // OK
156+ private var z : Int // error
157+ )
158+
159+ class AllUsed (
160+ k : Int , // OK
161+ private var y : Int // OK
162+ )(
163+ s : Int , // OK
164+ var t : Int , // OK
165+ private var z : Int // OK
166+ ) {
167+ def a = k + y + s + t + z
168+ }
169+
170+
171+
129172package foo .test .from .i16675:
130173 case class PositiveNumber private (i : Int ) // OK
131174 object PositiveNumber :
You can’t perform that action at this time.
0 commit comments