Skip to content
Draft
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 library/src/scala/AnyVal.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`

/** `AnyVal` is the root class of all *value types*, which describe values
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/AnyValCompanion.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`

/** A common supertype for companion classes of primitive types.
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/Boolean.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`

/** `Boolean` (equivalent to Java's `boolean` primitive type) is a
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/Byte.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`

/** `Byte`, a 8-bit signed integer (equivalent to Java's `byte` primitive type) is a
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/Char.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`

import scala.collection.immutable.NumericRange
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/Console.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`

import java.io.{ BufferedReader, InputStream, InputStreamReader, OutputStream, PrintStream, Reader }
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/Double.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`

/** `Double`, a 64-bit IEEE-754 floating point number (equivalent to Java's `double` primitive type) is a
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/DummyImplicit.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`

/** A type for which there is always an implicit value. */
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/Dynamic.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`

/** A marker trait that enables dynamic invocations. Instances `x` of this
Expand Down
15 changes: 8 additions & 7 deletions library/src/scala/Enumeration.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`

import scala.collection.{SpecificIterableFactory, StrictOptimizedIterableOps, View, immutable, mutable}
Expand Down Expand Up @@ -87,7 +88,7 @@ import scala.util.matching.Regex
* identifies values at run-time.
*/
@SerialVersionUID(8476000850333817230L)
abstract class Enumeration (initial: Int) extends Serializable {
abstract class Enumeration (initial: Int) extends Serializable, caps.Pure {
thisenum =>

def this() = this(0)
Expand Down Expand Up @@ -232,7 +233,7 @@ abstract class Enumeration (initial: Int) extends Serializable {

/** The type of the enumerated values. */
@SerialVersionUID(7091335633555234129L)
abstract class Value extends Ordered[Value] with Serializable {
abstract class Value extends Ordered[Value] with Serializable with caps.Pure {
/** The id and bit location of this enumeration value. */
def id: Int
/** A marker so we can tell whose values belong to whom come reflective-naming time. */
Expand Down Expand Up @@ -328,7 +329,7 @@ abstract class Enumeration (initial: Int) extends Serializable {
*/
def toBitMask: Array[Long] = nnIds.toBitMask

override protected def fromSpecific(coll: IterableOnce[Value]): ValueSet = ValueSet.fromSpecific(coll)
override protected def fromSpecific(coll: IterableOnce[Value]^): ValueSet = ValueSet.fromSpecific(coll)
override protected def newSpecificBuilder = ValueSet.newBuilder

def map(f: Value => Value): ValueSet = fromSpecific(new View.Map(this, f))
Expand All @@ -337,11 +338,11 @@ abstract class Enumeration (initial: Int) extends Serializable {
// necessary for disambiguation:
override def map[B](f: Value => B)(implicit @implicitNotFound(ValueSet.ordMsg) ev: Ordering[B]): immutable.SortedSet[B] =
super[SortedSet].map[B](f)
override def flatMap[B](f: Value => IterableOnce[B])(implicit @implicitNotFound(ValueSet.ordMsg) ev: Ordering[B]): immutable.SortedSet[B] =
override def flatMap[B](f: Value => IterableOnce[B]^)(implicit @implicitNotFound(ValueSet.ordMsg) ev: Ordering[B]): immutable.SortedSet[B] =
super[SortedSet].flatMap[B](f)
override def zip[B](that: IterableOnce[B])(implicit @implicitNotFound(ValueSet.zipOrdMsg) ev: Ordering[(Value, B)]): immutable.SortedSet[(Value, B)] =
override def zip[B](that: IterableOnce[B]^)(implicit @implicitNotFound(ValueSet.zipOrdMsg) ev: Ordering[(Value, B)]): immutable.SortedSet[(Value, B)] =
super[SortedSet].zip[B](that)
override def collect[B](pf: PartialFunction[Value, B])(implicit @implicitNotFound(ValueSet.ordMsg) ev: Ordering[B]): immutable.SortedSet[B] =
override def collect[B](pf: PartialFunction[Value, B]^)(implicit @implicitNotFound(ValueSet.ordMsg) ev: Ordering[B]): immutable.SortedSet[B] =
super[SortedSet].collect[B](pf)

@transient private[Enumeration] lazy val byName: Map[String, Value] = iterator.map( v => v.toString -> v).toMap
Expand All @@ -368,7 +369,7 @@ abstract class Enumeration (initial: Int) extends Serializable {
def clear() = b.clear()
def result() = new ValueSet(b.toImmutable)
}
def fromSpecific(it: IterableOnce[Value]): ValueSet =
def fromSpecific(it: IterableOnce[Value]^): ValueSet =
newBuilder.addAll(it).result()
}
}
1 change: 1 addition & 0 deletions library/src/scala/Equals.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`

/** An interface containing operations for equality.
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/Float.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`

/** `Float`, a 32-bit IEEE-754 floating point number (equivalent to Java's `float` primitive type) is a
Expand Down
6 changes: 3 additions & 3 deletions library/src/scala/IArray.scala
Original file line number Diff line number Diff line change
Expand Up @@ -368,21 +368,21 @@ object IArray:
* @param f the transformation function mapping elements to their sort keys
* @return a new array consisting of the elements of this array sorted by the value `f` produces for each
*/
extension [T](arr: IArray[T]) def sortBy[U](f: T => U)(using math.Ordering[U]): IArray[T] =
extension [T](arr: IArray[T]) def sortBy[U](f: T -> U)(using math.Ordering[U]): IArray[T] =
genericArrayOps(arr).sortBy(f)

/** Sorts this array according to a comparison function.
*
* @param f the comparison function returning true if its first argument should come first
* @return a new array consisting of the elements of this array sorted according to `f`
*/
extension [T](arr: IArray[T]) def sortWith(f: (T, T) => Boolean): IArray[T] =
extension [T](arr: IArray[T]) def sortWith(f: (T, T) -> Boolean): IArray[T] =
genericArrayOps(arr).sortWith(f)

/** Sorts this array according to an Ordering.
*
*/
extension [T](arr: IArray[T]) def sorted(using math.Ordering[T]^): IArray[T] =
extension [T](arr: IArray[T]) def sorted(using math.Ordering[T]): IArray[T] =
genericArrayOps(arr).sorted

/** Splits this array into a prefix/suffix pair according to a predicate.
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/Int.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`

/** `Int`, a 32-bit signed integer (equivalent to Java's `int` primitive type) is a
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/Long.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`

import scala.collection.immutable.NumericRange
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/MatchError.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`

/** This class implements errors which are thrown whenever an
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/NotImplementedError.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`

/** Throwing this exception can be a temporary replacement for a method
Expand Down
7 changes: 4 additions & 3 deletions library/src/scala/Option.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`

object Option {
Expand Down Expand Up @@ -402,7 +403,7 @@ sealed abstract class Option[+A] extends IterableOnce[A] with Product with Seria
* @param p the predicate used to test elements
* @return a `WithFilter` that applies `p` to this option before subsequent `map`, `flatMap`, `foreach`, or `withFilter` operations
*/
@inline final def withFilter(p: A => Boolean): WithFilter = new WithFilter(p)
@inline final def withFilter(p: A -> Boolean): WithFilter = new WithFilter(p)

/** We need a whole WithFilter class to honor the "doesn't create a new
* collection" contract even though it seems unlikely to matter much in a
Expand All @@ -414,7 +415,7 @@ sealed abstract class Option[+A] extends IterableOnce[A] with Product with Seria
def map[B](f: A => B): Option[B] = self filter p map f
def flatMap[B](f: A => Option[B]): Option[B] = self filter p flatMap f
def foreach[U](f: A => U): Unit = self filter p foreach f
def withFilter(q: A => Boolean): WithFilter = new WithFilter(x => p(x) && q(x))
def withFilter(q: A => Boolean): WithFilter^{this, q} = new WithFilter(x => p(x) && q(x))
}

/** Tests whether the option contains a given value as an element.
Expand Down Expand Up @@ -520,7 +521,7 @@ sealed abstract class Option[+A] extends IterableOnce[A] with Product with Seria
*
* @tparam B the result type of the partial function
*/
@inline final def collect[B](pf: PartialFunction[A, B]): Option[B] =
@inline final def collect[B](pf: PartialFunction[A, B]^): Option[B] =
if (!isEmpty) pf.lift(this.get) else None

/** Returns this $option if it is nonempty,
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/Product.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`
import language.experimental.captureChecking

Expand Down
1 change: 1 addition & 0 deletions library/src/scala/Product1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`

object Product1 {
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/ScalaReflectionException.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package scala

import language.experimental.captureChecking
import scala.language.`2.13`

/** An exception that indicates an error during Scala reflection.
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/Short.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`

/** `Short`, a 16-bit signed integer (equivalent to Java's `short` primitive type) is a
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/Specializable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`

/** A common supertype for companions of specializable types.
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/StringContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`
import java.lang.{ StringBuilder => JLSBuilder }
import scala.annotation.tailrec
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/Symbol.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`

/** This class provides a simple way to get unique objects for equal strings.
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/UninitializedError.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`

/** This class represents uninitialized variable/value errors.
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/UninitializedFieldError.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`

/** This class implements errors which are thrown whenever a
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/Unit.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`

/** `Unit` is a subtype of [[scala.AnyVal]]. There is only one value of type
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/ValueOf.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala

import language.experimental.captureChecking
import scala.language.`2.13`

/**
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/annotation/Annotation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala.annotation

import language.experimental.captureChecking
import scala.language.`2.13`

/**
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/annotation/ConstantAnnotation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala.annotation

import language.experimental.captureChecking
import scala.language.`2.13`

/**
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/annotation/StaticAnnotation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala.annotation

import language.experimental.captureChecking
import scala.language.`2.13`

/**
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/annotation/TypeConstraint.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala.annotation

import language.experimental.captureChecking
import scala.language.`2.13`

/** A marker for annotations that, when applied to a type, should be treated
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/annotation/compileTimeOnly.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala.annotation

import language.experimental.captureChecking
import scala.language.`2.13`
import scala.annotation.meta._

Expand Down
1 change: 1 addition & 0 deletions library/src/scala/annotation/implicitAmbiguous.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala.annotation

import language.experimental.captureChecking
import scala.language.`2.13`

/** To customize the error message that's emitted when an implicit search finds
Expand Down
1 change: 1 addition & 0 deletions library/src/scala/annotation/implicitNotFound.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala.annotation

import language.experimental.captureChecking
import scala.language.`2.13`

/** To customize the error message that's emitted when an implicit of type
Expand Down
2 changes: 2 additions & 0 deletions library/src/scala/annotation/internal/$into.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package scala.annotation.internal

import language.experimental.captureChecking

/** An internal annotation on (part of) a parameter type that serves as a marker where
* the original type was of the form `into[T]`. These annotated types are mapped back
* to `into[T]` types when forming a method types from the parameter types. The idea is
Expand Down
2 changes: 2 additions & 0 deletions library/src/scala/annotation/internal/onlyCapability.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package scala.annotation
package internal

import language.experimental.captureChecking

/** An annotation that represents a capability `c.only[T]`,
* encoded as `x.type @onlyCapability[T]`
*
Expand Down
Loading
Loading