Skip to content

Commit 0462b45

Browse files
committed
Avoid names object self types
1 parent 2664cc1 commit 0462b45

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/pos/typeclass-encoding2.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,22 +81,22 @@ object semiGroups {
8181
type Impl[T] = Extension[T, Monoid] with MonoidCommon
8282
}
8383

84-
implicit object IntOps extends Extension[Int, Monoid] with MonoidCommon { self =>
84+
implicit object IntOps extends Extension[Int, Monoid] with MonoidCommon {
8585
type This = Int
8686
type Instance = Monoid
8787
def unit: Int = 0
8888
def inject($this: Int) = new Monoid {
89-
val common: self.type = self
89+
val common: IntOps.this.type = IntOps.this
9090
def add(that: This): This = $this + that
9191
}
9292
}
9393

94-
implicit object StringOps extends Extension[String, Monoid] with MonoidCommon { self =>
94+
implicit object StringOps extends Extension[String, Monoid] with MonoidCommon {
9595
type This = String
9696
type Instance = Monoid
9797
def unit = ""
9898
def inject($this: String) = new Monoid {
99-
val common: self.type = self
99+
val common: StringOps.this.type = StringOps.this
100100
def add(that: This): This = $this.concat(that)
101101
}
102102
}
@@ -159,12 +159,12 @@ object ord {
159159
type Impl[T] = Extension[T, Ord] with OrdCommon
160160
}
161161

162-
implicit object IntOrd extends Extension[Int, Ord] with OrdCommon { self =>
162+
implicit object IntOrd extends Extension[Int, Ord] with OrdCommon {
163163
type This = Int
164164
type Instance = Ord
165165
val minimum: Int = Int.MinValue
166166
def inject($this: Int) = new Ord {
167-
val common: self.type = self
167+
val common: IntOrd.this.type = IntOrd.this
168168
def compareTo(that: This): Int =
169169
if (this < that) -1 else if (this > that) +1 else 0
170170
}
@@ -293,12 +293,12 @@ object functors {
293293
if (n == 0) Functor.impl[F].pure(x)
294294
else develop(n - 1, x, f).map(f)
295295

296-
implicit object ListMonad extends Extension1[List, Monad] with MonadCommon { self =>
296+
implicit object ListMonad extends Extension1[List, Monad] with MonadCommon {
297297
type This[A] = List[A]
298298
type Instance = Monad
299299
def pure[A](x: A) = x :: Nil
300300
def inject[A]($this: List[A]) = new Monad[A] {
301-
val common: self.type = self
301+
val common: ListMonad.this.type = ListMonad
302302
def flatMap[B](f: A => List[B]): List[B] = $this.flatMap(f)
303303
}
304304
}

0 commit comments

Comments
 (0)