Skip to content

Commit 61ba0e1

Browse files
committed
Move Pure to caps and make it non-experimental
1 parent 88961de commit 61ba0e1

File tree

28 files changed

+41
-44
lines changed

28 files changed

+41
-44
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ class Definitions {
10201020
@tu lazy val Caps_ContainsModule: Symbol = requiredModule("scala.caps.Contains")
10211021
@tu lazy val Caps_containsImpl: TermSymbol = Caps_ContainsModule.requiredMethod("containsImpl")
10221022

1023-
@tu lazy val PureClass: ClassSymbol = requiredClass("scala.Pure")
1023+
@tu lazy val PureClass: ClassSymbol = requiredClass("scala.caps.Pure")
10241024

10251025
// Annotation base classes
10261026
@tu lazy val AnnotationClass: ClassSymbol = requiredClass("scala.annotation.Annotation")

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ object TypeErasure {
109109
case _ => -1
110110

111111
def normalizeClass(cls: ClassSymbol)(using Context): ClassSymbol = {
112+
if (defn.specialErasure.contains(cls))
113+
return defn.specialErasure(cls).uncheckedNN
112114
if (cls.owner == defn.ScalaPackageClass) {
113-
if (defn.specialErasure.contains(cls))
114-
return defn.specialErasure(cls).uncheckedNN
115115
if (cls == defn.UnitClass)
116116
return defn.BoxedUnitClass
117117
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ class Erasure extends Phase with DenotTransformer {
191191
|| isAllowed(defn.TupleClass, "Tuple.scala")
192192
|| isAllowed(defn.NonEmptyTupleClass, "Tuple.scala")
193193
|| isAllowed(defn.PairClass, "Tuple.scala")
194-
|| isAllowed(defn.PureClass, "Pure.scala"),
194+
|| isAllowed(defn.PureClass, /* caps/ */ "Pure.scala"),
195195
i"The type $tp - ${tp.toString} of class ${tp.getClass} of tree $tree : ${tree.tpe} / ${tree.getClass} is illegal after erasure, phase = ${ctx.phase.prev}")
196196
}
197197
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package scala
2-
import annotation.experimental
2+
package caps
33

44
/** A marker trait that declares that all inheriting classes are "pure" in the
55
* sense that their values retain no capabilities including capabilities needed
66
* to perform effects. This has formal meaning only under capture checking.
77
*/
8-
@experimental trait Pure:
8+
trait Pure:
99
this: Pure =>

project/Build.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,6 @@ object Build {
10971097
file(s"${baseDirectory.value}/src/scala/CanEqual.scala"),
10981098
file(s"${baseDirectory.value}/src/scala/Conversion.scala"),
10991099
file(s"${baseDirectory.value}/src/scala/PolyFunction.scala"),
1100-
file(s"${baseDirectory.value}/src/scala/Pure.scala"),
11011100
file(s"${baseDirectory.value}/src/scala/IArray.scala"),
11021101
file(s"${baseDirectory.value}/src/scala/CanThrow.scala"),
11031102
file(s"${baseDirectory.value}/src/scala/Tuple.scala"),
@@ -1235,7 +1234,6 @@ object Build {
12351234
file(s"${baseDirectory.value}/src/scala/CanEqual.scala"),
12361235
file(s"${baseDirectory.value}/src/scala/Conversion.scala"),
12371236
file(s"${baseDirectory.value}/src/scala/PolyFunction.scala"),
1238-
file(s"${baseDirectory.value}/src/scala/Pure.scala"),
12391237
file(s"${baseDirectory.value}/src/scala/IArray.scala"),
12401238
file(s"${baseDirectory.value}/src/scala/CanThrow.scala"),
12411239
file(s"${baseDirectory.value}/src/scala/Tuple.scala"),

scala2-library-cc/src/scala/collection/Factory.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import caps.unsafe.unsafeAssumePure
3131
* @tparam A Type of elements (e.g. `Int`, `Boolean`, etc.)
3232
* @tparam C Type of collection (e.g. `List[Int]`, `TreeMap[Int, String]`, etc.)
3333
*/
34-
trait Factory[-A, +C] extends Pure {
34+
trait Factory[-A, +C] extends caps.Pure {
3535

3636
/**
3737
* @return A collection of type `C` containing the same elements
@@ -82,7 +82,7 @@ object Factory {
8282
* @define coll collection
8383
* @define Coll `Iterable`
8484
*/
85-
trait IterableFactory[+CC[_]] extends Serializable, Pure {
85+
trait IterableFactory[+CC[_]] extends Serializable, caps.Pure {
8686

8787
/** Creates a target $coll from an existing source collection
8888
*
@@ -389,7 +389,7 @@ trait SpecificIterableFactory[-A, +C] extends Factory[A, C] {
389389
* @define coll collection
390390
* @define Coll `Iterable`
391391
*/
392-
trait MapFactory[+CC[_, _]] extends Serializable, Pure {
392+
trait MapFactory[+CC[_, _]] extends Serializable, caps.Pure {
393393

394394
/**
395395
* An empty Map
@@ -462,7 +462,7 @@ object MapFactory {
462462
* @define coll collection
463463
* @define Coll `Iterable`
464464
*/
465-
trait EvidenceIterableFactory[+CC[_], Ev[_]] extends Serializable, Pure {
465+
trait EvidenceIterableFactory[+CC[_], Ev[_]] extends Serializable, caps.Pure {
466466

467467
def from[E : Ev](it: IterableOnce[E]^): CC[E]
468468

scala2-library-cc/src/scala/collection/Map.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ trait Map[K, +V]
2626
with MapOps[K, V, Map, Map[K, V]]
2727
with MapFactoryDefaults[K, V, Map, Iterable]
2828
with Equals
29-
with Pure {
29+
with caps.Pure {
3030

3131
def mapFactory: scala.collection.MapFactory[Map] = Map
3232

scala2-library-cc/src/scala/collection/Set.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ trait Set[A]
2626
with SetOps[A, Set, Set[A]]
2727
with Equals
2828
with IterableFactoryDefaults[A, Set]
29-
with Pure {
29+
with caps.Pure {
3030
self: Set[A] =>
3131

3232
def canEqual(that: Any) = true

scala2-library-cc/src/scala/collection/SortedMap.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ trait SortedMap[K, +V]
5151
trait SortedMapOps[K, +V, +CC[X, Y] <: Map[X, Y] with SortedMapOps[X, Y, CC, _], +C <: SortedMapOps[K, V, CC, C]]
5252
extends MapOps[K, V, Map, C]
5353
with SortedOps[K, C]
54-
with Pure {
54+
with caps.Pure {
5555

5656
/** The companion object of this sorted map, providing various factory methods.
5757
*

scala2-library-cc/src/scala/collection/StepperShape.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import scala.collection.Stepper.EfficientSplit
2020
/** An implicit StepperShape instance is used in the [[IterableOnce.stepper]] to return a possibly
2121
* specialized Stepper `S` according to the element type `T`.
2222
*/
23-
sealed trait StepperShape[-T, S <: Stepper[_]^] extends Pure {
23+
sealed trait StepperShape[-T, S <: Stepper[_]^] extends caps.Pure {
2424
/** Return the Int constant (as defined in the `StepperShape` companion object) for this `StepperShape`. */
2525
def shape: StepperShape.Shape
2626

0 commit comments

Comments
 (0)