Skip to content

Commit 44ffb68

Browse files
Kordyjanprolativ
authored andcommitted
Add since annotations to all symbols added in 3.1
1 parent ab3efcf commit 44ffb68

File tree

8 files changed

+29
-4
lines changed

8 files changed

+29
-4
lines changed

library/src/scala/CanEqual.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package scala
22

3-
import annotation.implicitNotFound
3+
import annotation.{ implicitNotFound, since }
44
import scala.collection.{Seq, Set}
55

66
/** A marker trait indicating that values of type `L` can be compared to values of type `R`. */
@@ -29,14 +29,18 @@ object CanEqual {
2929
// The next 6 definitions can go into the companion objects of their corresponding
3030
// classes. For now they are here in order not to have to touch the
3131
// source code of these classes
32+
@since("3.1")
3233
given canEqualSeqs[T, U](using eq: CanEqual[T, U]): CanEqual[Seq[T], Seq[U]] = derived
3334
given canEqualSeq[T](using eq: CanEqual[T, T]): CanEqual[Seq[T], Seq[T]] = derived // for `case Nil` in pattern matching
3435

3536
given canEqualSet[T, U](using eq: CanEqual[T, U]): CanEqual[Set[T], Set[U]] = derived
3637

38+
@since("3.1")
3739
given canEqualOptions[T, U](using eq: CanEqual[T, U]): CanEqual[Option[T], Option[U]] = derived
40+
@since("3.1")
3841
given canEqualOption[T](using eq: CanEqual[T, T]): CanEqual[Option[T], Option[T]] = derived // for `case None` in pattern matching
3942

43+
@since("3.1")
4044
given canEqualEither[L1, R1, L2, R2](
4145
using eqL: CanEqual[L1, L2], eqR: CanEqual[R1, R2]
4246
): CanEqual[Either[L1, R1], Either[L2, R2]] = derived

library/src/scala/Selectable.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package scala
22

3-
import scala.annotation.experimental
3+
import scala.annotation.since
44

55
/** A marker trait for objects that support structural selection via
66
* `selectDynamic` and `applyDynamic`
@@ -49,5 +49,6 @@ object Selectable:
4949
* the additional restriction that the signatures of the refinement and
5050
* the definition that implements the refinment must match.
5151
*/
52+
@since("3.1")
5253
trait WithoutPreciseParameterTypes extends Selectable
5354
end Selectable

library/src/scala/Tuple.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package scala
22

3-
import annotation.{experimental, showAsInfix}
3+
import annotation.{experimental, showAsInfix, since}
44
import compiletime._
55
import compiletime.ops.int._
66

@@ -260,7 +260,9 @@ object Tuple {
260260
def fromProductTyped[P <: Product](p: P)(using m: scala.deriving.Mirror.ProductOf[P]): m.MirroredElemTypes =
261261
runtime.Tuples.fromProduct(p).asInstanceOf[m.MirroredElemTypes]
262262

263+
@since("3.1")
263264
given canEqualEmptyTuple: CanEqual[EmptyTuple, EmptyTuple] = CanEqual.derived
265+
@since("3.1")
264266
given canEqualTuple[H1, T1 <: Tuple, H2, T2 <: Tuple](
265267
using eqHead: CanEqual[H1, H2], eqTail: CanEqual[T1, T2]
266268
): CanEqual[H1 *: T1, H2 *: T2] = CanEqual.derived

library/src/scala/annotation/experimental.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ package scala.annotation
55
* @see [[https://dotty.epfl.ch/docs/reference/other-new-features/experimental-defs]]
66
* @syntax markdown
77
*/
8+
@since("3.1")
89
class experimental extends StaticAnnotation

library/src/scala/annotation/internal/ErasedParam.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ package scala.annotation
22
package internal
33

44
/** An annotation produced by Namer to indicate an erased parameter */
5+
@since("3.1")
56
final class ErasedParam() extends Annotation

library/src/scala/annotation/internal/ProvisionalSuperClass.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ package scala.annotation
22
package internal
33

44
/** An annotation to record a provisional super class */
5+
@since("3.1")
56
class ProvisionalSuperClass extends StaticAnnotation
67

library/src/scala/quoted/Quotes.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
6868
* Emits an error and aborts if the expression does not represent a value or possibly contains side effects.
6969
* Otherwise returns the value.
7070
*/
71+
@since("3.1")
7172
def valueOrAbort(using FromExpr[T]): T
7273

7374
end extension
@@ -803,15 +804,18 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
803804
end IdentMethods
804805

805806
/** Pattern representing a `_` wildcard. */
807+
@since("3.1")
806808
type Wildcard <: Ident
807809

808810
/** `TypeTest` that allows testing at runtime in a pattern match if a `Tree` is a `Wildcard` */
811+
@since("3.1")
809812
given WildcardTypeTest: TypeTest[Tree, Wildcard]
810813

811814
/** Module object of `type Wildcard` */
812815
val Wildcard: WildcardModule
813816

814817
/** Methods of the module object `val Wildcard` */
818+
@since("3.1")
815819
trait WildcardModule { this: Wildcard.type =>
816820
/** Create a tree representing a `_` wildcard. */
817821
def apply(): Wildcard
@@ -1614,15 +1618,19 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
16141618
end WhileMethods
16151619

16161620
/** `TypeTest` that allows testing at runtime in a pattern match if a `Tree` is a `TypedOrTest` */
1621+
@since("3.1")
16171622
given TypedOrTestTypeTest: TypeTest[Tree, TypedOrTest]
16181623

16191624
/** Tree representing a type ascription or type test pattern `x: T` in the source code. */
1625+
@since("3.1")
16201626
type TypedOrTest <: Tree
16211627

16221628
/** Module object of `type TypedOrTest` */
1629+
@since("3.1")
16231630
val TypedOrTest: TypedOrTestModule
16241631

16251632
/** Methods of the module object `val TypedOrTest` */
1633+
@since("3.1")
16261634
trait TypedOrTestModule { this: TypedOrTest.type =>
16271635

16281636
/** Create a type ascription `<x: Tree>: <tpt: TypeTree>` */
@@ -1635,9 +1643,11 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
16351643
}
16361644

16371645
/** Makes extension methods on `TypedOrTest` available without any imports */
1646+
@since("3.1")
16381647
given TypedOrTestMethods: TypedOrTestMethods
16391648

16401649
/** Extension methods of `TypedOrTest` */
1650+
@since("3.1")
16411651
trait TypedOrTestMethods:
16421652
extension (self: TypedOrTest)
16431653
def tree: Tree
@@ -2165,6 +2175,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
21652175
/** Methods of the module object `val Unapply` */
21662176
trait UnapplyModule { this: Unapply.type =>
21672177
/** Create an `Unapply` tree representing a pattern `<fun>(<patterns*>)(using <implicits*>)` */
2178+
@since("3.1")
21682179
def apply(fun: Term, implicits: List[Term], patterns: List[Tree]): Unapply
21692180
/** Copy an `Unapply` tree representing a pattern `<fun>(<patterns*>)(using <implicits*>)` */
21702181
def copy(original: Tree)(fun: Term, implicits: List[Term], patterns: List[Tree]): Unapply
@@ -2278,6 +2289,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
22782289
/** Is this a given parameter clause `(using X1, ..., Xn)` or `(using x1: X1, ..., xn: Xn)` */
22792290
def isGiven: Boolean
22802291
/** Is this a erased parameter clause `(erased x1: X1, ..., xn: Xn)` */
2292+
@since("3.1")
22812293
def isErased: Boolean
22822294
end TermParamClauseMethods
22832295

@@ -2563,6 +2575,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
25632575
*
25642576
* @return true if the dealiased type of `self` is `TupleN[T1, T2, ..., Tn]`
25652577
*/
2578+
@since("3.1")
25662579
def isTupleN: Boolean
25672580

25682581
/** The type <this . sym>, reduced if possible */
@@ -3712,6 +3725,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
37123725
def memberFields: List[Symbol]
37133726

37143727
/** Get all non-private fields declared or inherited */
3728+
@since("3.1")
37153729
def fieldMembers: List[Symbol]
37163730

37173731
/** Get non-private named methods defined directly inside the class */

library/src/scala/quoted/Type.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package scala.quoted
22

3-
import scala.annotation.{compileTimeOnly, experimental}
3+
import scala.annotation.{compileTimeOnly, experimental, since}
44

55
/** Type (or type constructor) `T` needed contextually when using `T` in a quoted expression `'{... T ...}` */
66
abstract class Type[T <: AnyKind] private[scala]:
@@ -68,6 +68,7 @@ object Type:
6868
* ```
6969
* @syntax markdown
7070
*/
71+
@since("3.1")
7172
def valueOfTuple[T <: Tuple](using Type[T])(using Quotes): Option[T] =
7273
valueOfTuple(quotes.reflect.TypeRepr.of[T]).asInstanceOf[Option[T]]
7374

0 commit comments

Comments
 (0)