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.
Improve error message when using experimental definitions
When an experimental definition is used, the error message shows how to enable the experimental mode. Previously we only did this for experimental language features, but not for experimental definitions.
- Loading branch information
1 parent
8bcd9a9
commit 89d6104
Showing
3 changed files
with
30 additions
and
14 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
-- Error: tests/neg/use-experimental-def.scala:7:15 -------------------------------------------------------------------- | ||
7 |def bar: Int = foo // error | ||
| ^^^ | ||
| Experimental definition may only be used under experimental mode: | ||
| 1. in a definition marked as @experimental, or | ||
| 2. compiling with the -experimental compiler flag, or | ||
| 3. with a nightly or snapshot version of the compiler. | ||
| | ||
| method foo is marked @experimental | ||
| |
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,7 @@ | ||
//> using options -Yno-experimental | ||
|
||
import scala.annotation.experimental | ||
|
||
@experimental def foo: Int = 1 | ||
|
||
def bar: Int = foo // error |