-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add @experimental
annotation
#12102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
nicolasstucki
merged 13 commits into
scala:master
from
dotty-staging:add-experimental-annotation
May 10, 2021
Merged
Add @experimental
annotation
#12102
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
77fc0e2
Add `@experimental` annotation
nicolasstucki 4c67bb1
Do not add @experimental annotations to nested definitions
nicolasstucki 90e1729
Add comment
nicolasstucki a6e6c6b
Split tests
nicolasstucki 540e22f
Fixes after rebase
nicolasstucki d8dd54b
Fix experimental annotation detection
nicolasstucki bac0e98
Refacor code
nicolasstucki 112bea7
Do not check deprecation on TypeDef
nicolasstucki c8eb6cd
Fix experimental in signature check
nicolasstucki c950006
Avoid reporting extra errors on enums
nicolasstucki 59a2f32
Improve error messages for @experimental on case classes
nicolasstucki b5a2752
Remove redundant code
nicolasstucki 8c0fe71
Mark ErasedParam and TermParamClause.isErased as @experimental
nicolasstucki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,14 @@ | ||
package scala.annotation | ||
|
||
/** An annotation that can be used to mark a definition as experimental. | ||
* | ||
* This class is experimental as well as if it was defined as | ||
* ```scala | ||
* @experimental | ||
* class experimental extends StaticAnnotation | ||
* ``` | ||
* | ||
* @syntax markdown | ||
*/ | ||
// @experimental | ||
class experimental extends StaticAnnotation | ||
nicolasstucki marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package scala.annotation.internal | ||
|
||
import scala.annotation.Annotation | ||
package scala.annotation | ||
package internal | ||
|
||
/** An annotation produced by Namer to indicate an erased parameter */ | ||
@experimental | ||
final class ErasedParam() extends Annotation |
This file contains hidden or 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 hidden or 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
7 changes: 7 additions & 0 deletions
7
tests/neg-custom-args/no-experimental/experimentalAnnot.scala
This file contains hidden or 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 @@ | ||
import scala.annotation.experimental | ||
|
||
@experimental // error | ||
class myExperimentalAnnot extends scala.annotation.Annotation | ||
|
||
@myExperimentalAnnot // error | ||
def test: Unit = () |
26 changes: 26 additions & 0 deletions
26
tests/neg-custom-args/no-experimental/experimentalCaseClass.scala
This file contains hidden or 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,26 @@ | ||
import scala.annotation.experimental | ||
|
||
@experimental // error | ||
case class Foo(a: Int) | ||
|
||
@experimental // error | ||
case class Bar(a: Int) | ||
|
||
object Bar: | ||
def f(): Unit = () | ||
|
||
def test: Unit = | ||
Foo(2) // error | ||
val x: Foo = ??? // error | ||
|
||
x match | ||
case Foo(a) => // error | ||
|
||
|
||
Bar(2) // error | ||
val y: Bar = ??? // error | ||
|
||
y match | ||
case Bar(a) => // error | ||
|
||
Bar.f() // error |
12 changes: 12 additions & 0 deletions
12
tests/neg-custom-args/no-experimental/experimentalEnum.scala
This file contains hidden or 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,12 @@ | ||
import scala.annotation.experimental | ||
|
||
@experimental // error | ||
enum E: | ||
case A | ||
case B | ||
|
||
def test: Unit = | ||
E.A // error | ||
E.B // error | ||
val e: E = ??? // error | ||
() |
4 changes: 4 additions & 0 deletions
4
tests/neg-custom-args/no-experimental/experimentalExperimental.scala
This file contains hidden or 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,4 @@ | ||
import scala.annotation.experimental | ||
|
||
class MyExperimentalAnnot // error | ||
extends experimental // error |
8 changes: 8 additions & 0 deletions
8
tests/neg-custom-args/no-experimental/experimentalInline.scala
This file contains hidden or 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,8 @@ | ||
import scala.annotation.experimental | ||
|
||
@experimental | ||
inline def g() = () | ||
|
||
def test: Unit = | ||
g() // errors | ||
() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.