Skip to content

Make definitions used in capture checking again @experimental #16242

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
merged 3 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler/src/dotty/tools/dotc/core/StdNames.scala
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ object StdNames {
val derived: N = "derived"
val derives: N = "derives"
val doubleHash: N = "doubleHash"
val dotty: N = "dotty"
val drop: N = "drop"
val dynamics: N = "dynamics"
val elem: N = "elem"
Expand Down
2 changes: 2 additions & 0 deletions compiler/src/dotty/tools/dotc/transform/SymUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,8 @@ object SymUtils:
self.hasAnnotation(defn.ExperimentalAnnot)
|| isDefaultArgumentOfExperimentalMethod
|| (!self.is(Package) && self.owner.isInExperimentalScope)
|| self.topLevelClass.ownersIterator.exists(p =>
p.is(Package) && p.owner.isRoot && p.name == tpnme.dotty)

/** The declared self type of this class, as seen from `site`, stripping
* all refinements for opaque types.
Expand Down
4 changes: 2 additions & 2 deletions library/src/scala/annotation/retains.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ package scala.annotation
* The annotation can also be written explicitly if one wants to avoid the
* non-standard capturing type syntax.
*/
// @experimental // suppressed so we can use in compiler
@experimental
class retains(xs: Any*) extends annotation.StaticAnnotation

// @experimental // suppressed so we can use in compiler
@experimental
class retainsUniversal extends annotation.StaticAnnotation
3 changes: 1 addition & 2 deletions library/src/scala/caps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ package scala

import annotation.experimental

// @experimental , suppress @experimental so we can use in compiler itself
object caps:
@experimental object caps:

/** If argument is of type `cs T`, converts to type `box cs T`. This
* avoids the error that would be raised when boxing `*`.
Expand Down
3 changes: 0 additions & 3 deletions project/MiMaFilters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,5 @@ object MiMaFilters {
val Library: Seq[ProblemFilter] = Seq(
ProblemFilters.exclude[MissingClassProblem]("scala.annotation.internal.MappedAlternative"),
ProblemFilters.exclude[MissingClassProblem]("scala.caps"),
ProblemFilters.exclude[MissingClassProblem]("scala.caps$"),
ProblemFilters.exclude[MissingClassProblem]("scala.annotation.retains"),
ProblemFilters.exclude[MissingClassProblem]("scala.annotation.retainsUniversal"),
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package dotty.tools
object test {

val x = caps.unsafeBox

}
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ val experimentalDefinitionInLibrary = Set(
"scala.annotation.capability",
"scala.annotation.internal.CaptureChecked",
"scala.annotation.internal.requiresCapability",
//"scala.annotation.retains",
"scala.annotation.retains",
"scala.annotation.retainsUniversal",
"scala.annotation.retainsByName",
"scala.caps",
"scala.caps$",

//// New APIs: Mirror
// Can be stabilized in 3.3.0 or later.
Expand Down