Skip to content

Commit e038b78

Browse files
committed
Drop all uses of sealed on type parameters in tests
1 parent c1fc2c7 commit e038b78

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+268
-268
lines changed

tests/neg-custom-args/captures/capt-test.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def raise[E <: Exception](e: E): Nothing throws E = throw e
1414
def foo(x: Boolean): Int throws Fail =
1515
if x then 1 else raise(Fail())
1616

17-
def handle[E <: Exception, sealed R <: Top](op: (CT[E] @retains(caps.cap)) => R)(handler: E => R): R =
17+
def handle[E <: Exception, R <: Top](op: (CT[E] @retains(caps.cap)) => R)(handler: E => R): R =
1818
val x: CT[E] = ???
1919
try op(x)
2020
catch case ex: E => handler(ex)

tests/neg-custom-args/captures/heal-tparam-cs.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import language.experimental.captureChecking
22

33
trait Capp { def use(): Unit }
44

5-
def localCap[sealed T](op: (c: Capp^) => T): T = ???
5+
def localCap[T](op: (c: Capp^) => T): T = ???
66

77
def main(io: Capp^, net: Capp^): Unit = {
88

@@ -25,7 +25,7 @@ def main(io: Capp^, net: Capp^): Unit = {
2525
(c1: Capp^{io}) => () => { c1.use() }
2626
}
2727

28-
def localCap2[sealed T](op: (c: Capp^{io}) => T): T = ???
28+
def localCap2[T](op: (c: Capp^{io}) => T): T = ???
2929

3030
val test5: () ->{io} Unit =
3131
localCap2 { c => // ok

tests/neg-custom-args/captures/i15049.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ class Session:
22
def request = "Response"
33
class Foo:
44
private val session: Session^ = new Session
5-
def withSession[sealed T](f: Session^ => T): T = f(session)
5+
def withSession[T](f: Session^ => T): T = f(session)
66

77
def Test: Unit =
88
val f = new Foo

tests/neg-custom-args/captures/i15749a.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ def test =
1111
def wrapper[T](x: T): Wrapper[T] =
1212
[X] => (op: T ->{cap} X) => op(x)
1313

14-
def strictMap[A <: Top, sealed B <: Top](mx: Wrapper[A])(f: A ->{cap} B): Wrapper[B] =
14+
def strictMap[A <: Top, B <: Top](mx: Wrapper[A])(f: A ->{cap} B): Wrapper[B] =
1515
mx((x: A) => wrapper(f(x)))
1616

1717
def force[A](thunk: Unit ->{cap} A): A = thunk(u)
1818

19-
def forceWrapper[sealed A](mx: Wrapper[Unit ->{cap} A]): Wrapper[A] =
19+
def forceWrapper[A](mx: Wrapper[Unit ->{cap} A]): Wrapper[A] =
2020
// Γ ⊢ mx: Wrapper[□ {cap} Unit => A]
2121
// `force` should be typed as ∀(□ {cap} Unit -> A) A, but it can not
2222
strictMap[Unit ->{cap} A, A](mx)(t => force[A](t)) // error

tests/neg-custom-args/captures/leaking-iterators.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ end Iterator
3939
private final class ConcatIteratorCell[A](head: => IterableOnce[A]^):
4040
def headIterator: Iterator[A]^{this} = head.iterator
4141

42-
def usingLogFile[sealed R](op: FileOutputStream^ => R): R =
42+
def usingLogFile[R](op: FileOutputStream^ => R): R =
4343
val logFile = FileOutputStream("log")
4444
val result = op(logFile)
4545
logFile.close()

tests/neg-custom-args/captures/reaches.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
class File:
22
def write(): Unit = ???
33

4-
def usingFile[sealed T](f: File^ => T): T = ???
4+
def usingFile[T](f: File^ => T): T = ???
55

66
type Proc = () => Unit
77

8-
class Ref[sealed T](init: T):
8+
class Ref[T](init: T):
99
private var x: T = init
1010
def get: T = x
1111
def set(y: T) = { x = y }
@@ -45,7 +45,7 @@ def runAll3(xs: List[Proc]): Unit =
4545
next()
4646
cur.set(cur.get.tail: List[Proc])
4747

48-
class Id[sealed -A, sealed +B >: A]():
48+
class Id[-A, +B >: A]():
4949
def apply(a: A): B = a
5050

5151
def test =

tests/neg-custom-args/captures/recursive-leaking-local-cap.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import language.experimental.captureChecking
22
trait Cap:
33
def use: Int = 42
44

5-
def usingCap[sealed T](op: Cap^ => T): T = ???
5+
def usingCap[T](op: Cap^ => T): T = ???
66

77
def badTest(): Unit =
88
def bad(b: Boolean)(c: Cap^): Cap^{c} =

tests/neg-custom-args/captures/simple-using.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import java.io.*
2-
def usingLogFile[sealed T](op: FileOutputStream^ => T): T =
2+
def usingLogFile[T](op: FileOutputStream^ => T): T =
33
val logFile = FileOutputStream("log")
44
val result = op(logFile)
55
logFile.close()

tests/neg-custom-args/captures/try.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def raise[E <: Exception](e: E): Nothing throws E = throw e
1414
def foo(x: Boolean): Int throws Fail =
1515
if x then 1 else raise(Fail())
1616

17-
def handle[E <: Exception, sealed R <: Top](op: CT[E]^ => R)(handler: E => R): R =
17+
def handle[E <: Exception, R <: Top](op: CT[E]^ => R)(handler: E => R): R =
1818
val x: CT[E] = ???
1919
try op(x)
2020
catch case ex: E => handler(ex)

tests/neg-custom-args/captures/usingFile.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ object Test:
77
class Logger(f: OutputStream^):
88
def log(msg: String): Unit = ???
99

10-
def usingFile[sealed T](name: String, op: OutputStream^ => T): T =
10+
def usingFile[T](name: String, op: OutputStream^ => T): T =
1111
val f = new FileOutputStream(name)
1212
val result = op(f)
1313
f.close()

0 commit comments

Comments
 (0)