Skip to content

Commit 41a2251

Browse files
Kordyjanprolativ
authored andcommitted
Add since annotations to all symbols added in 3.1
1 parent 008a36c commit 41a2251

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
@@ -794,15 +795,18 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
794795
end IdentMethods
795796

796797
/** Pattern representing a `_` wildcard. */
798+
@since("3.1")
797799
type Wildcard <: Ident
798800

799801
/** `TypeTest` that allows testing at runtime in a pattern match if a `Tree` is a `Wildcard` */
802+
@since("3.1")
800803
given WildcardTypeTest: TypeTest[Tree, Wildcard]
801804

802805
/** Module object of `type Wildcard` */
803806
val Wildcard: WildcardModule
804807

805808
/** Methods of the module object `val Wildcard` */
809+
@since("3.1")
806810
trait WildcardModule { this: Wildcard.type =>
807811
/** Create a tree representing a `_` wildcard. */
808812
def apply(): Wildcard
@@ -1605,15 +1609,19 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
16051609
end WhileMethods
16061610

16071611
/** `TypeTest` that allows testing at runtime in a pattern match if a `Tree` is a `TypedOrTest` */
1612+
@since("3.1")
16081613
given TypedOrTestTypeTest: TypeTest[Tree, TypedOrTest]
16091614

16101615
/** Tree representing a type ascription or type test pattern `x: T` in the source code. */
1616+
@since("3.1")
16111617
type TypedOrTest <: Tree
16121618

16131619
/** Module object of `type TypedOrTest` */
1620+
@since("3.1")
16141621
val TypedOrTest: TypedOrTestModule
16151622

16161623
/** Methods of the module object `val TypedOrTest` */
1624+
@since("3.1")
16171625
trait TypedOrTestModule { this: TypedOrTest.type =>
16181626

16191627
/** Create a type ascription `<x: Tree>: <tpt: TypeTree>` */
@@ -1626,9 +1634,11 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
16261634
}
16271635

16281636
/** Makes extension methods on `TypedOrTest` available without any imports */
1637+
@since("3.1")
16291638
given TypedOrTestMethods: TypedOrTestMethods
16301639

16311640
/** Extension methods of `TypedOrTest` */
1641+
@since("3.1")
16321642
trait TypedOrTestMethods:
16331643
extension (self: TypedOrTest)
16341644
def tree: Tree
@@ -2156,6 +2166,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
21562166
/** Methods of the module object `val Unapply` */
21572167
trait UnapplyModule { this: Unapply.type =>
21582168
/** Create an `Unapply` tree representing a pattern `<fun>(<patterns*>)(using <implicits*>)` */
2169+
@since("3.1")
21592170
def apply(fun: Term, implicits: List[Term], patterns: List[Tree]): Unapply
21602171
/** Copy an `Unapply` tree representing a pattern `<fun>(<patterns*>)(using <implicits*>)` */
21612172
def copy(original: Tree)(fun: Term, implicits: List[Term], patterns: List[Tree]): Unapply
@@ -2269,6 +2280,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
22692280
/** Is this a given parameter clause `(using X1, ..., Xn)` or `(using x1: X1, ..., xn: Xn)` */
22702281
def isGiven: Boolean
22712282
/** Is this a erased parameter clause `(erased x1: X1, ..., xn: Xn)` */
2283+
@since("3.1")
22722284
def isErased: Boolean
22732285
end TermParamClauseMethods
22742286

@@ -2554,6 +2566,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
25542566
*
25552567
* @return true if the dealiased type of `self` is `TupleN[T1, T2, ..., Tn]`
25562568
*/
2569+
@since("3.1")
25572570
def isTupleN: Boolean
25582571

25592572
/** The type <this . sym>, reduced if possible */
@@ -3703,6 +3716,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
37033716
def memberFields: List[Symbol]
37043717

37053718
/** Get all non-private fields declared or inherited */
3719+
@since("3.1")
37063720
def fieldMembers: List[Symbol]
37073721

37083722
/** 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)