Skip to content

Commit ad531d9

Browse files
committed
Switch TypeApplications to inherited extensions
1 parent 9da0674 commit ad531d9

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,10 @@ object TypeApplications:
151151

152152
/** Extensions that model type application.
153153
*/
154-
trait TypeApplications:
154+
class TypeApplications:
155155
import TypeApplications.*
156156

157-
extension (self: Type) { // braces to avoid indent
157+
extension (self: Type) { // braces to avoid indenting existing code
158158
/** The type parameters of this type are:
159159
* For a ClassInfo type, the type parameters of its class.
160160
* For a typeref referring to a class, the type parameters of the class.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Names.Name
1111
import StdNames.nme
1212
import config.Feature
1313

14-
class TypeUtils:
14+
class TypeUtils extends TypeApplications:
1515
/** A decorator that provides methods on types
1616
* that are needed in the transformer pipeline.
1717
*/

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2169,11 +2169,7 @@ object Types extends TypeUtils {
21692169
/** Is the `hash` of this type the same for all possible sequences of enclosing binders? */
21702170
def hashIsStable: Boolean = true
21712171
}
2172-
object Type:
2173-
// Extensions that model type application.
2174-
given TypeApplications()
2175-
2176-
// end Type
2172+
end Type
21772173

21782174
// ----- Type categories ----------------------------------------------
21792175

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1911,9 +1911,9 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
19111911
dotc.core.Symbols.defn.isTupleNType(self)
19121912
def select(sym: Symbol): TypeRepr = self.select(sym)
19131913
def appliedTo(targ: TypeRepr): TypeRepr =
1914-
Types.Type.given_TypeApplications.appliedTo(self)(targ)
1914+
Types.appliedTo(self)(targ)
19151915
def appliedTo(targs: List[TypeRepr]): TypeRepr =
1916-
Types.Type.given_TypeApplications.appliedTo(self)(targs)
1916+
Types.appliedTo(self)(targs)
19171917
def substituteTypes(from: List[Symbol], to: List[TypeRepr]): TypeRepr =
19181918
self.subst(from, to)
19191919

0 commit comments

Comments
 (0)