Skip to content

Commit 99176ac

Browse files
committed
Stabilize 3.2 APIs
Stabilize the following APIs: * `scala.deriving.Mirror.fromTuple` * `scala.Tuple.:*" and `scala.Tuple.Append` * `scala.NonEmptyTuple.init` and `scala.Tuple.Init`, * `scala.NonEmptyTuple.last` and `scala.Tuple.Last`, * `scala.quoted.Quotes.reflectModule.AppliedTypeModule.apply` * `scala.quoted.Quotes.reflectModule.SymbolMethods.asQuotes` * `scala.quoted.Quotes.reflectModule.SymbolMethods.termRef` * `scala.quoted.Quotes.reflectModule.SymbolMethods.typeRef` * `scala.quoted.Quotes.reflectModule.TypeReprMethods.substituteTypes` * `scala.quoted.Quotes.reflectModule.TypeReprMethods.typeArgs` * `scala.quoted.Quotes.reflectModule.TypeTreeModule.ref` * `scala.Predef.eq` * `scala.Predef.ne`
1 parent 8bae490 commit 99176ac

File tree

9 files changed

+39
-75
lines changed

9 files changed

+39
-75
lines changed

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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 7 deletions
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 0 additions & 7 deletions
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,9 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
39573952
*
39583953
* @pre symbol.isType returns true
39593954
*/
3960-
@experimental
39613955
def typeRef: TypeRef
39623956

39633957
/** Term reference to the symbol usable in the scope of its owner. */
3964-
@experimental
39653958
def termRef: TermRef
39663959
end extension
39673960
}

library/src/scala/runtime/Tuples.scala

Lines changed: 0 additions & 5 deletions
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

Lines changed: 0 additions & 4 deletions
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

Lines changed: 7 additions & 0 deletions
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.scoverage.check

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ Inlined$package$
4242
Object
4343
covtest.Inlined$package$
4444
testInlined
45-
378
46-
405
47-
11
45+
340
46+
367
47+
9
4848
Scala3RunTime
4949
Select
5050
false
@@ -59,9 +59,9 @@ Inlined$package$
5959
Object
6060
covtest.Inlined$package$
6161
testInlined
62-
378
63-
420
64-
11
62+
340
63+
382
64+
9
6565
assertFailed
6666
Apply
6767
false
@@ -76,9 +76,9 @@ Inlined$package$
7676
Object
7777
covtest.Inlined$package$
7878
testInlined
79-
378
80-
420
81-
11
79+
340
80+
382
81+
9
8282
<none>
8383
Block
8484
true
@@ -127,9 +127,9 @@ Inlined$package$
127127
Object
128128
covtest.Inlined$package$
129129
testInlined
130-
378
131-
405
132-
11
130+
340
131+
367
132+
9
133133
Scala3RunTime
134134
Select
135135
false
@@ -144,9 +144,9 @@ Inlined$package$
144144
Object
145145
covtest.Inlined$package$
146146
testInlined
147-
378
148-
420
149-
11
147+
340
148+
382
149+
9
150150
assertFailed
151151
Apply
152152
false
@@ -161,9 +161,9 @@ Inlined$package$
161161
Object
162162
covtest.Inlined$package$
163163
testInlined
164-
378
165-
420
166-
11
164+
340
165+
382
166+
9
167167
<none>
168168
Block
169169
true
@@ -212,9 +212,9 @@ Inlined$package$
212212
Object
213213
covtest.Inlined$package$
214214
testInlined
215-
378
216-
405
217-
11
215+
340
216+
367
217+
9
218218
Scala3RunTime
219219
Select
220220
false
@@ -229,9 +229,9 @@ Inlined$package$
229229
Object
230230
covtest.Inlined$package$
231231
testInlined
232-
378
233-
420
234-
11
232+
340
233+
382
234+
9
235235
assertFailed
236236
Apply
237237
false
@@ -246,9 +246,9 @@ Inlined$package$
246246
Object
247247
covtest.Inlined$package$
248248
testInlined
249-
378
250-
420
251-
11
249+
340
250+
382
251+
9
252252
<none>
253253
Block
254254
true

tests/run-custom-args/tasty-inspector/stdlibExperimentalDefinitions.scala

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -50,37 +50,17 @@ val experimentalDefinitionInLibrary = Set(
5050
"scala.compiletime.ops.string$.Substring",
5151

5252
//// New APIs: Mirror
53-
// Can be stabilized in 3.2.0 or later.
54-
"scala.deriving.Mirror$.fromTuple", // Probably for 3.2.0
53+
// Can be stabilized in 3.3.0 or later.
5554
"scala.deriving.Mirror$.fromProductTyped", // This API is a bit convoluted. We may need some more feedback before we can stabilize it.
5655

57-
//// New APIs: Tuples
58-
// Should be stabilized in 3.2.0.
59-
"scala.Tuple.:*", "scala.Tuple$.Append", "scala.runtime.Tuples$.append",
60-
"scala.NonEmptyTuple.init", "scala.Tuple$.Init", "scala.runtime.Tuples$.init",
61-
"scala.Tuple$.Last", "scala.NonEmptyTuple.last", "scala.runtime.Tuples$.last",
62-
63-
//// New APIs: Quotes
64-
// Should be stabilized in 3.2.0.
65-
"scala.quoted.Quotes.reflectModule.AppliedTypeModule.apply",
66-
"scala.quoted.Quotes.reflectModule.SymbolMethods.asQuotes",
67-
"scala.quoted.Quotes.reflectModule.SymbolMethods.termRef",
68-
"scala.quoted.Quotes.reflectModule.SymbolMethods.typeRef",
69-
"scala.quoted.Quotes.reflectModule.TypeReprMethods.substituteTypes",
70-
"scala.quoted.Quotes.reflectModule.TypeReprMethods.typeArgs",
71-
"scala.quoted.Quotes.reflectModule.TypeTreeModule.ref",
72-
// Can be stabilized in 3.2.0 (unsure) or later
56+
//// New APIs: Quotes
57+
// Can be stabilized in 3.3.0 (unsure) or later
7358
"scala.quoted.Quotes.reflectModule.CompilationInfoModule.XmacroSettings",
7459
// Cant be stabilized yet.
7560
// Need newClass variant that can add constructor parameters.
7661
// Need experimental annotation macros to check that design works.
7762
"scala.quoted.Quotes.reflectModule.ClassDefModule.apply",
7863
"scala.quoted.Quotes.reflectModule.SymbolModule.newClass",
79-
80-
//// New extension methods: Explicit Nulls
81-
// Should be stabilized in 3.2.0.
82-
"scala.Predef$.eq",
83-
"scala.Predef$.ne",
8464
)
8565

8666

0 commit comments

Comments
 (0)