forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow experimental erased in experimental scopes
Closes scala#13392
- Loading branch information
1 parent
ce0e25c
commit e7ad723
Showing
5 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
tests/neg-custom-args/no-experimental/experimentalErased.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import language.experimental.erasedDefinitions | ||
import annotation.experimental | ||
|
||
@experimental | ||
erased class Foo | ||
|
||
erased class Bar // error | ||
|
||
@experimental | ||
erased def foo = 2 | ||
|
||
erased def bar = 2 // error | ||
|
||
@experimental | ||
erased val foo2 = 2 | ||
|
||
erased val bar2 = 2 // error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import language.experimental.erasedDefinitions | ||
import annotation.experimental | ||
|
||
@experimental | ||
erased class Foo | ||
|
||
erased class Bar | ||
|
||
@experimental | ||
erased def foo = 2 | ||
|
||
erased def bar = 2 | ||
|
||
@experimental | ||
erased val foo2 = 2 | ||
|
||
erased val bar2 = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package scala | ||
import language.experimental.erasedDefinitions | ||
import annotation.{implicitNotFound, experimental} | ||
|
||
@experimental | ||
@implicitNotFound("The capability to throw exception ${E} is missing.\nThe capability can be provided by one of the following:\n - A using clause `(using CanThrow[${E}])`\n - A `throws` clause in a result type such as `X throws ${E}`\n - an enclosing `try` that catches ${E}") | ||
erased class CanThrow[-E <: Exception] | ||
|
||
@experimental | ||
object unsafeExceptions: | ||
given canThrowAny: CanThrow[Exception] = ??? |