Skip to content

Commit 0bed6fd

Browse files
Refactor decorateTypeApplication as implicit class
1 parent c01612a commit 0bed6fd

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,11 @@ object TypeApplications {
154154
}
155155
}
156156

157-
import TypeApplications._
158-
159157
/** A decorator that provides methods for modeling type application */
160-
class TypeApplications(val self: Type) extends AnyVal {
158+
trait TypeApplications extends Any {
159+
def self: Type
160+
161+
import TypeApplications._
161162

162163
/** The type parameters of this type are:
163164
* For a ClassInfo type, the type parameters of its class.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4560,12 +4560,12 @@ object Types {
45604560
}
45614561

45624562
// ----- Decorator implicits --------------------------------------------
4563-
4564-
implicit def decorateTypeApplications(tpe: Type): TypeApplications = new TypeApplications(tpe)
4563+
implicit class TypeApplicationsypyp(val self: Type) extends AnyVal with TypeApplications
45654564

45664565
implicit class typeListDeco(val tps1: List[Type]) extends AnyVal {
45674566
@tailrec def stableHash: Boolean =
45684567
tps1.isEmpty || tps1.head.stableHash && tps1.tail.stableHash
4568+
45694569
@tailrec def equalElements(tps2: List[Type], bs: BinderPairs): Boolean =
45704570
(tps1 `eq` tps2) || {
45714571
if (tps1.isEmpty) tps2.isEmpty

0 commit comments

Comments
 (0)