Skip to content

Commit fa9c3cc

Browse files
committed
Switch TypeApplications from export to given
1 parent 1091031 commit fa9c3cc

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

@@ -4370,10 +4373,10 @@ object Types extends TypeUtils {
43704373
setVariances(tparams.tail, vs.tail)
43714374

43724375
override val isDeclaredVarianceLambda = variances.nonEmpty
4373-
if isDeclaredVarianceLambda then setVariances(this.typeParams, variances)
4376+
if isDeclaredVarianceLambda then setVariances(typeParams, variances)
43744377

43754378
def declaredVariances =
4376-
if isDeclaredVarianceLambda then this.typeParams.map(_.declaredVariance)
4379+
if isDeclaredVarianceLambda then typeParams.map(_.declaredVariance)
43774380
else Nil
43784381

43794382
override def computeHash(bs: Binders): Int =
@@ -4386,7 +4389,7 @@ object Types extends TypeUtils {
43864389
paramNames.eqElements(that.paramNames)
43874390
&& isDeclaredVarianceLambda == that.isDeclaredVarianceLambda
43884391
&& (!isDeclaredVarianceLambda
4389-
|| this.typeParams.corresponds(that.typeParams)((x, y) =>
4392+
|| typeParams.corresponds(that.typeParams)((x, y) =>
43904393
x.declaredVariance == y.declaredVariance))
43914394
&& {
43924395
val bs1 = new SomeBinderPairs(this, that, bs)
@@ -7160,8 +7163,6 @@ object Types extends TypeUtils {
71607163

71617164
// ----- Helpers and Decorator implicits --------------------------------------
71627165

7163-
export TypeApplications.{EtaExpandIfHK as _, EtaExpansion as _, TypeParamInfo as _, *}
7164-
71657166
extension (tps1: List[Type]) {
71667167
@tailrec def hashIsStable: Boolean =
71677168
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)