Skip to content

Commit b4d40ff

Browse files
committed
Adapt test for -Wunused:privates
1 parent d2c86b9 commit b4d40ff

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ class CheckUnused extends MiniPhase:
241241
//! DIFFERS FROM MINIPHASE
242242
typeTraverser(unusedDataApply).traverse(t.tpe)
243243
traverseChildren(tree)(using newCtx)
244-
case tree =>
244+
case _ =>
245245
//! DIFFERS FROM MINIPHASE
246246
traverseChildren(tree)(using newCtx)
247247
end traverse

tests/neg-custom-args/fatal-warnings/i15503b.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ class Foo {
5959
var e1 = 1 // error not set
6060
def e2 = e1 // OK
6161
val e3 = e2 // OK
62-
e3
62+
e3
6363

6464
val g = // OK
6565
var e1 = 1 // OK
6666
def e2 = e1 // OK
6767
val e3 = e2 // OK
6868
e1 = e3 // OK
69-
e3
69+
e3
7070

7171
def d = 1 // OK
7272

tests/neg-custom-args/fatal-warnings/i15503c.scala

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,37 @@ class A:
1212
private[this] val f = e // OK
1313
private val g = f // OK
1414

15+
private[A] var h = 1 // OK
16+
private[this] var i = h // error not set
17+
private var j = i // error not set
18+
19+
private[this] var k = 1 // OK
20+
private var l = 2 // OK
21+
private val m = // error
22+
k = l
23+
l = k
24+
l
25+
1526
private def fac(x: Int): Int = // error
1627
if x == 0 then 1 else x * fac(x - 1)
1728

1829
val x = 1 // OK
1930
def y = 2 // OK
2031
def z = g // OK
32+
var w = 2 // OK
2133

2234
package foo.test.contructors:
2335
case class A private (x:Int) // OK
2436
class B private (val x: Int) // OK
2537
class C private (private val x: Int) // error
2638
class D private (private val x: Int): // OK
2739
def y = x
28-
40+
class E private (private var x: Int): // error not set
41+
def y = x
42+
class F private (private var x: Int): // OK
43+
def y =
44+
x = 3
45+
x
2946

3047
package test.foo.i16682:
3148
object myPackage:

0 commit comments

Comments
 (0)