Skip to content

Commit 5a6f16a

Browse files
Merge pull request #15197 from dotty-staging/stabilize-3.2-apis
Stabilize 3.2 APIs
2 parents 2516e71 + 4c80d35 commit 5a6f16a

File tree

10 files changed

+132
-94
lines changed

10 files changed

+132
-94
lines changed

compiler/test/dotty/tools/dotc/coverage/CoverageTests.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class CoverageTests:
4444
def runOnFile(p: Path): Boolean =
4545
scalaFile.matches(p) &&
4646
(Properties.testsFilter.isEmpty || Properties.testsFilter.exists(p.toString.contains))
47-
47+
4848
Files.walk(dir).filter(runOnFile).forEach(path => {
4949
val fileName = path.getFileName.toString.stripSuffix(".scala")
5050
val targetDir = computeCoverageInTmp(path, dir, run)

library/src/scala/Tuple.scala

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package scala
22

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

@@ -22,7 +22,6 @@ sealed trait Tuple extends Product {
2222
runtime.Tuples.toIArray(this)
2323

2424
/** Return a copy of `this` tuple with an element appended */
25-
@experimental
2625
inline def :* [This >: this.type <: Tuple, L] (x: L): Append[This, L] =
2726
runtime.Tuples.append(x, this).asInstanceOf[Append[This, L]]
2827

@@ -84,7 +83,6 @@ sealed trait Tuple extends Product {
8483
object Tuple {
8584

8685
/** Type of a tuple with an element appended */
87-
@experimental
8886
type Append[X <: Tuple, Y] <: Tuple = X match {
8987
case EmptyTuple => Y *: EmptyTuple
9088
case x *: xs => x *: Append[xs, Y]
@@ -96,7 +94,6 @@ object Tuple {
9694
}
9795

9896
/** Type of the initial part of the tuple without its last element */
99-
@experimental
10097
type Init[X <: Tuple] <: Tuple = X match {
10198
case _ *: EmptyTuple => EmptyTuple
10299
case x *: xs =>
@@ -109,7 +106,6 @@ object Tuple {
109106
}
110107

111108
/** Type of the last element of a tuple */
112-
@experimental
113109
type Last[X <: Tuple] = X match {
114110
case x *: EmptyTuple => x
115111
case _ *: xs => Last[xs]
@@ -289,12 +285,10 @@ sealed trait NonEmptyTuple extends Tuple {
289285
runtime.Tuples.apply(this, 0).asInstanceOf[Head[This]]
290286

291287
/** Get the initial part of the tuple without its last element */
292-
@experimental
293288
inline def init[This >: this.type <: NonEmptyTuple]: Init[This] =
294289
runtime.Tuples.init(this).asInstanceOf[Init[This]]
295290

296291
/** Get the last of this tuple */
297-
@experimental
298292
inline def last[This >: this.type <: NonEmptyTuple]: Last[This] =
299293
runtime.Tuples.last(this).asInstanceOf[Last[This]]
300294

library/src/scala/deriving/Mirror.scala

-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ object Mirror {
5757
p.fromProduct(a)
5858

5959
/** Create a new instance of type `T` with elements taken from tuple `t`. */
60-
@annotation.experimental
6160
def fromTuple(t: p.MirroredElemTypes): T =
6261
p.fromProduct(t)
6362
}

library/src/scala/quoted/Quotes.scala

+4-8
Original file line numberDiff line numberDiff line change
@@ -1722,7 +1722,6 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
17221722
*
17231723
* @param sym The type symbol for which we are creating a type tree reference.
17241724
*/
1725-
@experimental
17261725
def ref(typeSymbol: Symbol): TypeTree
17271726
}
17281727

@@ -2644,11 +2643,9 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
26442643
/** Substitute all types that refer in their symbol attribute to
26452644
* one of the symbols in `from` by the corresponding types in `to`.
26462645
*/
2647-
@experimental
26482646
def substituteTypes(from: List[Symbol], to: List[TypeRepr]): TypeRepr
26492647

26502648
/** The applied type arguments (empty if there is no such arguments) */
2651-
@experimental
26522649
def typeArgs: List[TypeRepr]
26532650
end extension
26542651
}
@@ -2800,7 +2797,6 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
28002797
/** Methods of the module object `val AppliedType` */
28012798
trait AppliedTypeModule { this: AppliedType.type =>
28022799
/** Applied the type constructor `T` to a list of type arguments `T_1,..,T_n` to create `T[T_1,..,T_n]` */
2803-
@experimental
28042800
def apply(tycon: TypeRepr, args: List[TypeRepr]): AppliedType
28052801
def unapply(x: AppliedType): (TypeRepr, List[TypeRepr])
28062802
}
@@ -3947,7 +3943,6 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
39473943
* '{ val x = ???; x }.asTerm
39483944
* ```
39493945
*/
3950-
@experimental
39513946
def asQuotes: Nested
39523947

39533948
/** Type reference to the symbol usable in the scope of its owner.
@@ -3957,11 +3952,12 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
39573952
*
39583953
* @pre symbol.isType returns true
39593954
*/
3960-
@experimental
39613955
def typeRef: TypeRef
39623956

3963-
/** Term reference to the symbol usable in the scope of its owner. */
3964-
@experimental
3957+
/** Term reference to the symbol usable in the scope of its owner.
3958+
*
3959+
* @pre symbol.isType returns false
3960+
*/
39653961
def termRef: TermRef
39663962
end extension
39673963
}

library/src/scala/runtime/Tuples.scala

-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package scala.runtime
22

3-
import scala.annotation.experimental
4-
53
object Tuples {
64

75
inline val MaxSpecialized = 22
@@ -427,7 +425,6 @@ object Tuples {
427425
}
428426
}
429427

430-
@experimental
431428
def append(x: Any, self: Tuple): Tuple = (self: Any) match {
432429
case xxl: TupleXXL => xxlAppend(x, xxl).asInstanceOf[Tuple]
433430
case _ => specialCaseAppend(x, self)
@@ -500,13 +497,11 @@ object Tuples {
500497
}
501498
}
502499

503-
@experimental
504500
def init(self: NonEmptyTuple): Tuple = (self: Any) match {
505501
case xxl: TupleXXL => xxlInit(xxl)
506502
case _ => specialCaseInit(self)
507503
}
508504

509-
@experimental
510505
def last(self: NonEmptyTuple): Any = (self: Any) match {
511506
case self: Product => self.productElement(self.productArity - 1)
512507
}

library/src/scala/runtime/stdLibPatches/Predef.scala

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package scala.runtime.stdLibPatches
22

3-
import scala.annotation.experimental
4-
53
object Predef:
64
import compiletime.summonFrom
75

@@ -54,13 +52,11 @@ object Predef:
5452
/** Enables an expression of type `T|Null`, where `T` is a subtype of `AnyRef`, to be checked for `null`
5553
* using `eq` rather than only `==`. This is needed because `Null` no longer has
5654
* `eq` or `ne` methods, only `==` and `!=` inherited from `Any`. */
57-
@experimental
5855
inline def eq(inline y: AnyRef | Null): Boolean =
5956
x.asInstanceOf[AnyRef] eq y.asInstanceOf[AnyRef]
6057
/** Enables an expression of type `T|Null`, where `T` is a subtype of `AnyRef`, to be checked for `null`
6158
* using `ne` rather than only `!=`. This is needed because `Null` no longer has
6259
* `eq` or `ne` methods, only `==` and `!=` inherited from `Any`. */
63-
@experimental
6460
inline def ne(inline y: AnyRef | Null): Boolean =
6561
!(x eq y)
6662

project/MiMaFilters.scala

+7
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,12 @@ object MiMaFilters {
1010
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.quoted.runtime.QuoteUnpickler.unpickleTypeV2"),
1111

1212
ProblemFilters.exclude[MissingClassProblem]("scala.annotation.since"),
13+
14+
// APIs will be added in 3.2.0
15+
ProblemFilters.exclude[ReversedMissingMethodProblem]("scala.quoted.Quotes#reflectModule#AppliedTypeModule.apply"),
16+
ProblemFilters.exclude[ReversedMissingMethodProblem]("scala.quoted.Quotes#reflectModule#SymbolMethods.asQuotes"),
17+
ProblemFilters.exclude[ReversedMissingMethodProblem]("scala.quoted.Quotes#reflectModule#SymbolMethods.typeRef"),
18+
ProblemFilters.exclude[ReversedMissingMethodProblem]("scala.quoted.Quotes#reflectModule#SymbolMethods.termRef"),
19+
ProblemFilters.exclude[ReversedMissingMethodProblem]("scala.quoted.Quotes#reflectModule#TypeTreeModule.ref"),
1320
)
1421
}

tests/coverage/pos/Inlined.scala

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ package covtest
33
// Checks that we use the new positions of the inlined code properly
44
def testInlined(): Unit =
55
val l = 1
6-
assert(l == 1) // scala.Predef.assert is inline in dotty
6+
assert(l == 1)
77
assert(l == List(l).length)
88
assert(List(l).length == 1)
9+
10+
transparent inline def assert(inline assertion: Boolean): Unit =
11+
if !assertion then scala.runtime.Scala3RunTime.assertFailed()

0 commit comments

Comments
 (0)