Skip to content

Commit 90f600e

Browse files
committed
Add explicit @experimental to inner experimental classes
MiMa seems to check if the definition is experimental but it is missing the check if the owner is experimental.
1 parent 004a2fd commit 90f600e

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

library/src/scala/annotation/MainAnnotation.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ object MainAnnotation:
9191
* @param documentation The documentation of the main method without the `@param` documentation (see Parameter.documentaion)
9292
* @param parameters Information about the parameters of the main method
9393
*/
94+
@experimental // MiMa does not check scope inherited @experimental
9495
final class Info(
9596
val name: String,
9697
val documentation: String,
@@ -111,6 +112,7 @@ object MainAnnotation:
111112
* @param documentation The documentation of the parameter (from `@param` documentation in the main method)
112113
* @param annotations The annotations of the parameter that extend `ParameterAnnotation`
113114
*/
115+
@experimental // MiMa does not check scope inherited @experimental
114116
final class Parameter(
115117
val name: String,
116118
val typeName: String,
@@ -121,6 +123,7 @@ object MainAnnotation:
121123
)
122124

123125
/** Marker trait for annotations that will be included in the Parameter annotations. */
126+
@experimental // MiMa does not check scope inherited @experimental
124127
trait ParameterAnnotation extends StaticAnnotation
125128

126129
end MainAnnotation

library/src/scala/annotation/newMain.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ final class newMain extends MainAnnotation[FromString, Any]:
217217
hasParseErrors = true
218218
() => throw new AssertionError("trying to get invalid argument")
219219

220-
220+
@experimental // MiMa does not check scope inherited @experimental
221221
private object Help:
222222

223223
/** The name of the special argument to display the method's help.
@@ -321,6 +321,7 @@ final class newMain extends MainAnnotation[FromString, Any]:
321321

322322
end Help
323323

324+
@experimental // MiMa does not check scope inherited @experimental
324325
private class Names(info: Info):
325326

326327
checkNames()

tests/run-custom-args/tasty-inspector/stdlibExperimentalDefinitions.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,20 @@ val experimentalDefinitionInLibrary = Set(
3131
// Should we have better support for main annotation macros?
3232
"scala.annotation.MainAnnotation",
3333
"scala.annotation.MainAnnotation$",
34+
"scala.annotation.MainAnnotation$.Info",
35+
"scala.annotation.MainAnnotation$.Parameter",
36+
"scala.annotation.MainAnnotation$.ParameterAnnotation",
37+
3438

3539
//// New feature: prototype of new version of @main
3640
// This will never be stabilized. When it is ready it should replace the old @main annotation (requires scala.annotation.MainAnnotation).
3741
// Needs user feedback.
3842
"scala.annotation.newMain",
3943
"scala.annotation.newMain$",
4044
"scala.annotation.newMain$.alias",
45+
"scala.annotation.newMain.Help",
46+
"scala.annotation.newMain.Help$",
47+
"scala.annotation.newMain.Names",
4148

4249
//// New APIs: Mirror
4350
// Can be stabilized in 3.3.0 or later.

0 commit comments

Comments
 (0)