Skip to content

Commit 62d3875

Browse files
authored
Make definitions used in capture checking again @experimental (#16242)
#16199 dropped their experimental status to allow experimenting with compiling the compiler under -Ycc, but that was meant as a local change that should not have been propagated to main.
2 parents 45ac398 + ea8e4c0 commit 62d3875

File tree

7 files changed

+16
-8
lines changed

7 files changed

+16
-8
lines changed

compiler/src/dotty/tools/dotc/core/StdNames.scala

+1
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ object StdNames {
445445
val derived: N = "derived"
446446
val derives: N = "derives"
447447
val doubleHash: N = "doubleHash"
448+
val dotty: N = "dotty"
448449
val drop: N = "drop"
449450
val dynamics: N = "dynamics"
450451
val elem: N = "elem"

compiler/src/dotty/tools/dotc/transform/SymUtils.scala

+2
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,8 @@ object SymUtils:
363363
self.hasAnnotation(defn.ExperimentalAnnot)
364364
|| isDefaultArgumentOfExperimentalMethod
365365
|| (!self.is(Package) && self.owner.isInExperimentalScope)
366+
|| self.topLevelClass.ownersIterator.exists(p =>
367+
p.is(Package) && p.owner.isRoot && p.name == tpnme.dotty)
366368

367369
/** The declared self type of this class, as seen from `site`, stripping
368370
* all refinements for opaque types.

library/src/scala/annotation/retains.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ package scala.annotation
1111
* The annotation can also be written explicitly if one wants to avoid the
1212
* non-standard capturing type syntax.
1313
*/
14-
// @experimental // suppressed so we can use in compiler
14+
@experimental
1515
class retains(xs: Any*) extends annotation.StaticAnnotation
1616

17-
// @experimental // suppressed so we can use in compiler
17+
@experimental
1818
class retainsUniversal extends annotation.StaticAnnotation

library/src/scala/caps.scala

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ package scala
22

33
import annotation.experimental
44

5-
// @experimental , suppress @experimental so we can use in compiler itself
6-
object caps:
5+
@experimental object caps:
76

87
/** If argument is of type `cs T`, converts to type `box cs T`. This
98
* avoids the error that would be raised when boxing `*`.

project/MiMaFilters.scala

-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,5 @@ object MiMaFilters {
55
val Library: Seq[ProblemFilter] = Seq(
66
ProblemFilters.exclude[MissingClassProblem]("scala.annotation.internal.MappedAlternative"),
77
ProblemFilters.exclude[MissingClassProblem]("scala.caps"),
8-
ProblemFilters.exclude[MissingClassProblem]("scala.caps$"),
9-
ProblemFilters.exclude[MissingClassProblem]("scala.annotation.retains"),
10-
ProblemFilters.exclude[MissingClassProblem]("scala.annotation.retainsUniversal"),
118
)
129
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package dotty.tools
2+
object test {
3+
4+
val x = caps.unsafeBox
5+
6+
}

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,11 @@ val experimentalDefinitionInLibrary = Set(
5050
"scala.annotation.capability",
5151
"scala.annotation.internal.CaptureChecked",
5252
"scala.annotation.internal.requiresCapability",
53-
//"scala.annotation.retains",
53+
"scala.annotation.retains",
54+
"scala.annotation.retainsUniversal",
5455
"scala.annotation.retainsByName",
56+
"scala.caps",
57+
"scala.caps$",
5558

5659
//// New APIs: Mirror
5760
// Can be stabilized in 3.3.0 or later.

0 commit comments

Comments
 (0)