Skip to content

Commit 375de66

Browse files
authored
Merge pull request #10360 from dotty-staging/move-scala-internal-to-runtime
Move scala.internal.{MatchCase,TypeBox} to scala.runtime.
2 parents 38b4a7e + f361c4d commit 375de66

File tree

7 files changed

+19
-5
lines changed

7 files changed

+19
-5
lines changed

compiler/src/dotty/tools/dotc/core/Definitions.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -843,10 +843,10 @@ class Definitions {
843843
@tu lazy val EqlClass: ClassSymbol = requiredClass("scala.Eql")
844844
def Eql_eqlAny(using Context): TermSymbol = EqlClass.companionModule.requiredMethod(nme.eqlAny)
845845

846-
@tu lazy val TypeBoxClass: ClassSymbol = requiredClass("scala.internal.TypeBox")
846+
@tu lazy val TypeBoxClass: ClassSymbol = requiredClass("scala.runtime.TypeBox")
847847
@tu lazy val TypeBox_CAP: TypeSymbol = TypeBoxClass.requiredType(tpnme.CAP)
848848

849-
@tu lazy val MatchCaseClass: ClassSymbol = requiredClass("scala.internal.MatchCase")
849+
@tu lazy val MatchCaseClass: ClassSymbol = requiredClass("scala.runtime.MatchCase")
850850
@tu lazy val NotClass: ClassSymbol = requiredClass("scala.util.Not")
851851
@tu lazy val Not_value: Symbol = NotClass.companionModule.requiredMethod(nme.value)
852852

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package scala.runtime
2+
3+
/** A type constructor for a case in a match type.
4+
*/
5+
final abstract class MatchCase[Pat, +Body]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package scala.runtime
2+
3+
/** A type for skolems that are generated during capture conversion. Capture conversion
4+
* narrows the type of a tree whose type has wildcard arguments. A typical situation
5+
* is a tree `t` of type `C[_ >: L <: U]` and an expected type `C[X]` where `X` is an
6+
* instantiatable type variable. To be able to instantiate `X`, we cast the tree to type
7+
* `X[$n.CAP]` where `$n` is a fresh skolem type with underlying type `TypeBox[L, U]`.
8+
*/
9+
final abstract class TypeBox[-L <: U, +U] {
10+
type CAP >: L <: U
11+
}

library/src/scala/Tuple.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package scala
22
import annotation.showAsInfix
33
import compiletime._
4-
import internal._
54

65
/** Tuple of arbitrary arity */
76
sealed trait Tuple extends Product {

tests/run-macros/tasty-construct-types/Macro_1.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ object Macros {
3636
TypeLambda(
3737
List("t"),
3838
_ => List(TypeBounds(TypeRepr.of[Nothing], TypeRepr.of[Any])),
39-
tl => TypeRepr.of[scala.internal.MatchCase].appliedTo(List(TypeRepr.of[List].appliedTo(tl.param(0)), tl.param(0)))))
39+
tl => TypeRepr.of[scala.runtime.MatchCase].appliedTo(List(TypeRepr.of[List].appliedTo(tl.param(0)), tl.param(0)))))
4040
)
4141

4242
assert(x1T =:= TypeRepr.of[1])
@@ -53,4 +53,3 @@ object Macros {
5353
}
5454
}
5555
}
56-

0 commit comments

Comments
 (0)