File tree 2 files changed +4
-10
lines changed
2 files changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ object QPrivTest {
28
28
29
29
case class E protected (i : Int )
30
30
object ETest {
31
- def e1 : E = E (1 )
31
+ def e1 : E = E (1 ) // error: apply is protected
32
32
def e2 : E = e2.copy(2 ) // error: copy is protected
33
33
}
34
34
@@ -37,6 +37,6 @@ object qualified_protected {
37
37
}
38
38
object QProtTest {
39
39
import qualified_protected .*
40
- def f1 : F = F (1 )
40
+ def f1 : F = F (1 ) // error: apply is protected
41
41
def f2 : F = f2.copy(2 ) // error: copy is protected
42
42
}
Original file line number Diff line number Diff line change @@ -26,22 +26,16 @@ case class C protected (i: Int)
26
26
class CSub extends C (1 ) {
27
27
def c = copy(2 ) // copy is accessible in subclass
28
28
}
29
- object CTest {
30
- def c = C (1 ) // apply is public
31
- }
32
29
33
30
object qualified_protected {
34
31
case class C protected [qualified_protected] (i : Int )
35
32
class CSub extends C (1 ) {
36
33
def c = copy(2 ) // copy is accessible in subclass
37
34
}
38
35
object CTest {
39
- def c = C (1 ) // apply is public
36
+ def c = C (1 ) // apply is protected[qualified_protected]
40
37
def checkExtendsFunction : Int => C = C // companion extends (Int => C)
41
38
}
42
39
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
47
41
}
You can’t perform that action at this time.
0 commit comments