Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dwijnand committed Jan 13, 2022
1 parent f87ea8a commit 7cd058f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
4 changes: 2 additions & 2 deletions tests/neg/caseclass-access.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ object QPrivTest {

case class E protected (i: Int)
object ETest {
def e1: E = E(1)
def e1: E = E(1) // error: apply is protected
def e2: E = e2.copy(2) // error: copy is protected
}

Expand All @@ -37,6 +37,6 @@ object qualified_protected {
}
object QProtTest {
import qualified_protected.*
def f1: F = F(1)
def f1: F = F(1) // error: apply is protected
def f2: F = f2.copy(2) // error: copy is protected
}
10 changes: 2 additions & 8 deletions tests/pos/caseclass-access.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,16 @@ case class C protected (i: Int)
class CSub extends C(1) {
def c = copy(2) // copy is accessible in subclass
}
object CTest {
def c = C(1) // apply is public
}

object qualified_protected {
case class C protected[qualified_protected] (i: Int)
class CSub extends C(1) {
def c = copy(2) // copy is accessible in subclass
}
object CTest {
def c = C(1) // apply is public
def c = C(1) // apply is protected[qualified_protected]
def checkExtendsFunction: Int => C = C // companion extends (Int => C)
}

def c = C(1).copy(2)
}
object CQualifiedTest {
def c = qualified_protected.C(1) // apply is public
def c = C(1).copy(2) // apply and copy are accessible in qualified_protected object
}

0 comments on commit 7cd058f

Please sign in to comment.