Skip to content

Commit 8fa281e

Browse files
committed
Switch TypeApplications from export to given
1 parent 04fca6b commit 8fa281e

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
@@ -2134,6 +2134,9 @@ object Types extends TypeUtils {
21342134
/** Is the `hash` of this type the same for all possible sequences of enclosing binders? */
21352135
def hashIsStable: Boolean = true
21362136
}
2137+
object Type:
2138+
// Extensions that model type application.
2139+
given TypeApplications()
21372140

21382141
// end Type
21392142

@@ -4374,10 +4377,10 @@ object Types extends TypeUtils {
43744377
setVariances(tparams.tail, vs.tail)
43754378

43764379
override val isDeclaredVarianceLambda = variances.nonEmpty
4377-
if isDeclaredVarianceLambda then setVariances(this.typeParams, variances)
4380+
if isDeclaredVarianceLambda then setVariances(typeParams, variances)
43784381

43794382
def declaredVariances =
4380-
if isDeclaredVarianceLambda then this.typeParams.map(_.declaredVariance)
4383+
if isDeclaredVarianceLambda then typeParams.map(_.declaredVariance)
43814384
else Nil
43824385

43834386
override def computeHash(bs: Binders): Int =
@@ -4390,7 +4393,7 @@ object Types extends TypeUtils {
43904393
paramNames.eqElements(that.paramNames)
43914394
&& isDeclaredVarianceLambda == that.isDeclaredVarianceLambda
43924395
&& (!isDeclaredVarianceLambda
4393-
|| this.typeParams.corresponds(that.typeParams)((x, y) =>
4396+
|| typeParams.corresponds(that.typeParams)((x, y) =>
43944397
x.declaredVariance == y.declaredVariance))
43954398
&& {
43964399
val bs1 = new SomeBinderPairs(this, that, bs)
@@ -7183,8 +7186,6 @@ object Types extends TypeUtils {
71837186

71847187
// ----- Helpers and Decorator implicits --------------------------------------
71857188

7186-
export TypeApplications.{EtaExpandIfHK as _, EtaExpansion as _, TypeParamInfo as _, *}
7187-
71887189
extension (tps1: List[Type]) {
71897190
@tailrec def hashIsStable: Boolean =
71907191
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)