Skip to content

Commit f99621d

Browse files
committed
Internal change: Drop last implicit class from Decorators
1 parent 9d8aa71 commit f99621d

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

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

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@ import printing.Formatting._
1515
/** This object provides useful implicit decorators for types defined elsewhere */
1616
object Decorators {
1717

18-
/** Extension methods for toType/TermName methods on strings.
19-
* They are in an implicit object for now, so that we can import decorators
20-
* with a normal wildcard. In the future, once #9255 is in trunk, replace with
21-
* a simple collective extension.
22-
*/
18+
/** Extension methods for toType/TermName methods on strings. */
2319
extension (pn: PreName)
2420
def toTermName: TermName = pn match
2521
case s: String => termName(s)
@@ -79,7 +75,7 @@ object Decorators {
7975
/** Implements filterConserve, zipWithConserve methods
8076
* on lists that avoid duplication of list nodes where feasible.
8177
*/
82-
implicit class ListDecorator[T](val xs: List[T]) extends AnyVal {
78+
extension [T](xs: List[T])
8379

8480
final def mapconserve[U](f: T => U): List[U] = {
8581
@tailrec
@@ -205,11 +201,10 @@ object Decorators {
205201
}
206202

207203
/** Union on lists seen as sets */
208-
def | (ys: List[T]): List[T] = xs ::: (ys filterNot (xs contains _))
204+
def setUnion (ys: List[T]): List[T] = xs ::: ys.filterNot(xs contains _)
209205

210206
/** Intersection on lists seen as sets */
211-
def & (ys: List[T]): List[T] = xs filter (ys contains _)
212-
}
207+
def setIntersect (ys: List[T]): List[T] = xs.filter(ys contains _)
213208

214209
extension [T, U](xss: List[List[T]])
215210
def nestedMap(f: T => U): List[List[U]] = xss match

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import scala.annotation.internal.sharable
1717
object Names {
1818
import NameKinds._
1919

20-
/** Things that can be turned into names with `totermName` and `toTypeName`
21-
* Decorators defines implements these as extension methods for strings.
20+
/** Things that can be turned into names with `toTermName` and `toTypeName`
21+
* Decorators implements these as extension methods for strings.
2222
*/
2323
type PreName = Name | String
2424

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ class OrderingConstraint(private val boundsMap: ParamBounds,
400400
case param: TypeParamRef if contains(param) =>
401401
param :: (if (isUpper) upper(param) else lower(param))
402402
case tp: AndType if isUpper =>
403-
dependentParams(tp.tp1, isUpper) | (dependentParams(tp.tp2, isUpper))
403+
dependentParams(tp.tp1, isUpper).setUnion(dependentParams(tp.tp2, isUpper))
404404
case tp: OrType if !isUpper =>
405405
dependentParams(tp.tp1, isUpper).intersect(dependentParams(tp.tp2, isUpper))
406406
case EtaExpansion(tycon) =>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ object Types {
542542
case tp: ClassInfo =>
543543
tp.cls :: Nil
544544
case AndType(l, r) =>
545-
l.parentSymbols(include) | r.parentSymbols(include)
545+
l.parentSymbols(include).setUnion(r.parentSymbols(include))
546546
case OrType(l, r) =>
547547
l.parentSymbols(include) intersect r.parentSymbols(include) // TODO does not conform to spec
548548
case _ =>

0 commit comments

Comments
 (0)