Skip to content

Commit 7cd058f

Browse files
committed
Fix tests
1 parent f87ea8a commit 7cd058f

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

tests/neg/caseclass-access.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ object QPrivTest {
2828

2929
case class E protected (i: Int)
3030
object ETest {
31-
def e1: E = E(1)
31+
def e1: E = E(1) // error: apply is protected
3232
def e2: E = e2.copy(2) // error: copy is protected
3333
}
3434

@@ -37,6 +37,6 @@ object qualified_protected {
3737
}
3838
object QProtTest {
3939
import qualified_protected.*
40-
def f1: F = F(1)
40+
def f1: F = F(1) // error: apply is protected
4141
def f2: F = f2.copy(2) // error: copy is protected
4242
}

tests/pos/caseclass-access.scala

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,16 @@ case class C protected (i: Int)
2626
class CSub extends C(1) {
2727
def c = copy(2) // copy is accessible in subclass
2828
}
29-
object CTest {
30-
def c = C(1) // apply is public
31-
}
3229

3330
object qualified_protected {
3431
case class C protected[qualified_protected] (i: Int)
3532
class CSub extends C(1) {
3633
def c = copy(2) // copy is accessible in subclass
3734
}
3835
object CTest {
39-
def c = C(1) // apply is public
36+
def c = C(1) // apply is protected[qualified_protected]
4037
def checkExtendsFunction: Int => C = C // companion extends (Int => C)
4138
}
4239

43-
def c = C(1).copy(2)
44-
}
45-
object CQualifiedTest {
46-
def c = qualified_protected.C(1) // apply is public
40+
def c = C(1).copy(2) // apply and copy are accessible in qualified_protected object
4741
}

0 commit comments

Comments
 (0)