Skip to content

Commit 641dffa

Browse files
committed
Make CanThrow a SharedCapability
1 parent 4c53fd1 commit 641dffa

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

library/src/scala/CanThrow.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import annotation.{implicitNotFound, experimental, capability}
88
*/
99
@experimental
1010
@implicitNotFound("The capability to throw exception ${E} is missing.\nThe capability can be provided by one of the following:\n - Adding a using clause `(using CanThrow[${E}])` to the definition of the enclosing method\n - Adding `throws ${E}` clause after the result type of the enclosing method\n - Wrapping this piece of code with a `try` block that catches ${E}")
11-
erased class CanThrow[-E <: Exception] extends caps.Capability
11+
erased class CanThrow[-E <: Exception] extends caps.SharedCapability
1212

1313
@experimental
1414
object unsafeExceptions:

tests/pos-custom-args/captures/erased-methods.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ class Ex2 extends Exception("Ex2")
77
class Ex3 extends Exception("Ex3")
88

99
def foo8a(i: Int) =
10-
(erased xx1: CanThrow[Ex2]^) ?=> throw new Ex2
10+
(erased xx1: CanThrow[Ex2]) ?=> throw new Ex2
1111

1212
def foo9a(i: Int)
13-
: (erased x$0: CanThrow[Ex3]^)
14-
?=> (erased x$1: CanThrow[Ex2]^)
15-
?=> (erased x$2: CanThrow[Ex1]^)
13+
: (erased x$0: CanThrow[Ex3])
14+
?=> (erased x$1: CanThrow[Ex2])
15+
?=> (erased x$2: CanThrow[Ex1])
1616
?=> Unit
17-
= (erased x$1: CanThrow[Ex3]^)
18-
?=> (erased x$2: CanThrow[Ex2]^)
19-
?=> (erased x$3: CanThrow[Ex1]^)
17+
= (erased x$1: CanThrow[Ex3])
18+
?=> (erased x$2: CanThrow[Ex2])
19+
?=> (erased x$3: CanThrow[Ex1])
2020
?=> throw new Ex3

0 commit comments

Comments
 (0)