Skip to content

Commit 58459fb

Browse files
committed
Switch TypeApplications from export to given
1 parent ce8bba7 commit 58459fb

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import StdNames.nme
1313
import Flags.{Module, Provisional}
1414
import dotty.tools.dotc.config.Config
1515

16-
object TypeApplications {
16+
object TypeApplications:
1717

1818
type TypeParamInfo = ParamInfo.Of[TypeName]
1919

@@ -148,8 +148,12 @@ object TypeApplications {
148148
}
149149
}
150150

151-
// Extensions that model type application.
152-
extension (self: Type) {
151+
/** Extensions that model type application.
152+
*/
153+
trait TypeApplications:
154+
import TypeApplications.*
155+
156+
extension (self: Type) { // braces to avoid indent
153157
/** The type parameters of this type are:
154158
* For a ClassInfo type, the type parameters of its class.
155159
* For a typeref referring to a class, the type parameters of the class.
@@ -584,4 +588,3 @@ object TypeApplications {
584588
assert(!self.isInstanceOf[TypeBounds], "no TypeBounds allowed")
585589
self
586590
}
587-
}

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2132,6 +2132,9 @@ object Types extends TypeUtils {
21322132
/** Is the `hash` of this type the same for all possible sequences of enclosing binders? */
21332133
def hashIsStable: Boolean = true
21342134
}
2135+
object Type:
2136+
// Extensions that model type application.
2137+
given TypeApplications()
21352138

21362139
// end Type
21372140

@@ -4372,10 +4375,10 @@ object Types extends TypeUtils {
43724375
setVariances(tparams.tail, vs.tail)
43734376

43744377
override val isDeclaredVarianceLambda = variances.nonEmpty
4375-
if isDeclaredVarianceLambda then setVariances(this.typeParams, variances)
4378+
if isDeclaredVarianceLambda then setVariances(typeParams, variances)
43764379

43774380
def declaredVariances =
4378-
if isDeclaredVarianceLambda then this.typeParams.map(_.declaredVariance)
4381+
if isDeclaredVarianceLambda then typeParams.map(_.declaredVariance)
43794382
else Nil
43804383

43814384
override def computeHash(bs: Binders): Int =
@@ -4388,7 +4391,7 @@ object Types extends TypeUtils {
43884391
paramNames.eqElements(that.paramNames)
43894392
&& isDeclaredVarianceLambda == that.isDeclaredVarianceLambda
43904393
&& (!isDeclaredVarianceLambda
4391-
|| this.typeParams.corresponds(that.typeParams)((x, y) =>
4394+
|| typeParams.corresponds(that.typeParams)((x, y) =>
43924395
x.declaredVariance == y.declaredVariance))
43934396
&& {
43944397
val bs1 = new SomeBinderPairs(this, that, bs)
@@ -7162,8 +7165,6 @@ object Types extends TypeUtils {
71627165

71637166
// ----- Helpers and Decorator implicits --------------------------------------
71647167

7165-
export TypeApplications.{EtaExpandIfHK as _, EtaExpansion as _, TypeParamInfo as _, *}
7166-
71677168
extension (tps1: List[Type]) {
71687169
@tailrec def hashIsStable: Boolean =
71697170
tps1.isEmpty || tps1.head.hashIsStable && tps1.tail.hashIsStable

compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1897,9 +1897,9 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
18971897
dotc.core.Symbols.defn.isTupleNType(self)
18981898
def select(sym: Symbol): TypeRepr = self.select(sym)
18991899
def appliedTo(targ: TypeRepr): TypeRepr =
1900-
dotc.core.Types.appliedTo(self)(targ)
1900+
Types.Type.given_TypeApplications.appliedTo(self)(targ)
19011901
def appliedTo(targs: List[TypeRepr]): TypeRepr =
1902-
dotc.core.Types.appliedTo(self)(targs)
1902+
Types.Type.given_TypeApplications.appliedTo(self)(targs)
19031903
def substituteTypes(from: List[Symbol], to: List[TypeRepr]): TypeRepr =
19041904
self.subst(from, to)
19051905

0 commit comments

Comments
 (0)