Skip to content

Commit 5cc7de5

Browse files
committed
remove deprecations that can be resolved with 2.12 library
1 parent 40ee013 commit 5cc7de5

File tree

68 files changed

+140
-138
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+140
-138
lines changed

compiler/src/dotty/tools/backend/jvm/GenBCode.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,11 +394,11 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter
394394
}
395395
for ((label, i) <- initialLabels.iterator.zipWithIndex) {
396396
mv.visitLabel(label)
397-
emitLambdaDeserializeIndy(groups(i))
397+
emitLambdaDeserializeIndy(groups(i).toIndexedSeq)
398398
mv.visitInsn(ARETURN)
399399
}
400400
mv.visitLabel(terminalLabel)
401-
emitLambdaDeserializeIndy(groups(numGroups - 1))
401+
emitLambdaDeserializeIndy(groups(numGroups - 1).toIndexedSeq)
402402
mv.visitInsn(ARETURN)
403403
}
404404

compiler/src/dotty/tools/backend/sjs/JSCodeGen.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ class JSCodeGen()(implicit ctx: Context) {
194194
ctx.settings.outputDir.value
195195

196196
val pathParts = sym.fullName.toString.split("[./]")
197-
val dir = (outputDirectory /: pathParts.init)(_.subdirectoryNamed(_))
197+
val dir = pathParts.init.foldLeft(outputDirectory)(_.subdirectoryNamed(_))
198198

199199
var filename = pathParts.last
200200
if (sym.is(ModuleClass))

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,7 @@ object desugar {
12781278
val ttree = ctx.typerPhase match {
12791279
case phase: FrontEnd if phase.stillToBeEntered(parts.last) =>
12801280
val prefix =
1281-
parts.init.foldLeft((Ident(nme.ROOTPKG): Tree))((qual, name) =>
1281+
parts.init.foldLeft(Ident(nme.ROOTPKG): Tree)((qual, name) =>
12821282
Select(qual, name.toTermName))
12831283
Select(prefix, parts.last.toTypeName)
12841284
case _ =>

compiler/src/dotty/tools/dotc/ast/tpd.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
295295
for (tparam <- cls.typeParams if !(bodyTypeParams contains tparam))
296296
yield TypeDef(tparam)
297297
val findLocalDummy = FindLocalDummyAccumulator(cls)
298-
val localDummy = ((NoSymbol: Symbol) /: body)(findLocalDummy.apply)
298+
val localDummy = body.foldLeft(NoSymbol: Symbol)(findLocalDummy.apply)
299299
.orElse(ctx.newLocalDummy(cls))
300300
val impl = untpd.Template(constr, parents, Nil, selfType, newTypeParams ++ body)
301301
.withType(localDummy.termRef)
@@ -873,7 +873,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
873873
* `tree (argss(0)) ... (argss(argss.length -1))`
874874
*/
875875
def appliedToArgss(argss: List[List[Tree]])(implicit ctx: Context): Tree =
876-
((tree: Tree) /: argss)(Apply(_, _))
876+
argss.foldLeft(tree: Tree)(Apply(_, _))
877877

878878
/** The current tree applied to (): `tree()` */
879879
def appliedToNone(implicit ctx: Context): Apply = appliedToArgs(Nil)

compiler/src/dotty/tools/dotc/ast/untpd.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
354354
* PrepareInlineable.
355355
*/
356356
def New(tpt: Tree, argss: List[List[Tree]])(implicit ctx: Context): Tree =
357-
ensureApplied((makeNew(tpt) /: argss)(Apply(_, _)))
357+
ensureApplied(argss.foldLeft(makeNew(tpt))(Apply(_, _)))
358358

359359
/** A new expression with constrictor and possibly type arguments. See
360360
* `New(tpt, argss)` for details.

compiler/src/dotty/tools/dotc/classpath/DirectoryClassPath.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ trait DirectoryLookup[FileEntryType <: ClassRepresentation] extends ClassPath {
5151
case Some(directory) => listChildren(directory, Some(isPackage))
5252
}
5353
val prefix = PackageNameUtils.packagePrefix(inPackage)
54-
nestedDirs.map(f => PackageEntryImpl(prefix + getName(f)))
54+
nestedDirs.toIndexedSeq.map(f => PackageEntryImpl(prefix + getName(f)))
5555
}
5656

5757
protected def files(inPackage: String): Seq[FileEntryType] = {

compiler/src/dotty/tools/dotc/classpath/VirtualDirectoryClassPath.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ case class VirtualDirectoryClassPath(dir: VirtualDirectory) extends ClassPath wi
1313
// From AbstractFileClassLoader
1414
private final def lookupPath(base: AbstractFile)(pathParts: Seq[String], directory: Boolean): AbstractFile = {
1515
var file: AbstractFile = base
16-
val dirParts = pathParts.init.toIterator
16+
val dirParts = pathParts.init.iterator
1717
while (dirParts.hasNext) {
1818
val dirPart = dirParts.next
1919
file = file.lookupName(dirPart, directory = true)
@@ -25,7 +25,7 @@ case class VirtualDirectoryClassPath(dir: VirtualDirectory) extends ClassPath wi
2525

2626
protected def emptyFiles: Array[AbstractFile] = Array.empty
2727
protected def getSubDir(packageDirName: String): Option[AbstractFile] =
28-
Option(lookupPath(dir)(packageDirName.split(java.io.File.separator), directory = true))
28+
Option(lookupPath(dir)(packageDirName.split(java.io.File.separator).toIndexedSeq, directory = true))
2929
protected def listChildren(dir: AbstractFile, filter: Option[AbstractFile => Boolean] = None): Array[F] = filter match {
3030
case Some(f) => dir.iterator.filter(f).toArray
3131
case _ => dir.toArray
@@ -42,7 +42,7 @@ case class VirtualDirectoryClassPath(dir: VirtualDirectory) extends ClassPath wi
4242

4343
def findClassFile(className: String): Option[AbstractFile] = {
4444
val relativePath = FileUtils.dirPath(className) + ".class"
45-
Option(lookupPath(dir)(relativePath.split(java.io.File.separator), directory = false))
45+
Option(lookupPath(dir)(relativePath.split(java.io.File.separator).toIndexedSeq, directory = false))
4646
}
4747

4848
private[dotty] def classes(inPackage: String): Seq[ClassFileEntry] = files(inPackage)

compiler/src/dotty/tools/dotc/config/Settings.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ object Settings {
9494
def legalChoices: String =
9595
if (choices.isEmpty) ""
9696
else choices match {
97-
case r: Range => r.head + ".." + r.last
97+
case r: Range => s"${r.head}..${r.last}"
9898
case xs: List[_] => xs.mkString(", ")
9999
}
100100

@@ -205,10 +205,10 @@ object Settings {
205205
userSetSettings(state).mkString("(", " ", ")")
206206

207207
private def checkDependencies(state: ArgsSummary): ArgsSummary =
208-
(state /: userSetSettings(state.sstate))(checkDependenciesOfSetting)
208+
userSetSettings(state.sstate).foldLeft(state)(checkDependenciesOfSetting)
209209

210210
private def checkDependenciesOfSetting(state: ArgsSummary, setting: Setting[_]) =
211-
(state /: setting.depends) { (s, dep) =>
211+
setting.depends.foldLeft(state) { (s, dep) =>
212212
val (depSetting, reqValue) = dep
213213
if (depSetting.valueIn(state.sstate) == reqValue) s
214214
else s.fail(s"incomplete option ${setting.name} (requires ${depSetting.name})")

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,10 @@ class CheckRealizable(implicit ctx: Context) {
171171
val baseProblems =
172172
tp.baseClasses.map(_.baseTypeOf(tp)).flatMap(baseTypeProblems)
173173

174-
((((Realizable: Realizability)
175-
/: memberProblems)(_ andAlso _)
176-
/: refinementProblems)(_ andAlso _)
177-
/: baseProblems)(_ andAlso _)
174+
baseProblems.foldLeft(
175+
refinementProblems.foldLeft(
176+
memberProblems.foldLeft(
177+
Realizable: Realizability)(_ andAlso _))(_ andAlso _))(_ andAlso _)
178178
}
179179

180180
/** `Realizable` if all of `tp`'s non-strict fields have realizable types,
@@ -199,7 +199,7 @@ class CheckRealizable(implicit ctx: Context) {
199199
// Reason: An embedded field could well be nullable, which means it
200200
// should not be part of a path and need not be checked; but we cannot recognize
201201
// this situation until we have a typesystem that tracks nullability.
202-
((Realizable: Realizability) /: tp.fields)(checkField)
202+
tp.fields.foldLeft(Realizable: Realizability)(checkField)
203203
else
204204
Realizable
205205
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ trait ConstraintHandling[AbstractContext] {
7272
def nonParamBounds(param: TypeParamRef)(implicit actx: AbstractContext): TypeBounds = constraint.nonParamBounds(param)
7373

7474
def fullLowerBound(param: TypeParamRef)(implicit actx: AbstractContext): Type =
75-
(nonParamBounds(param).lo /: constraint.minLower(param))(_ | _)
75+
constraint.minLower(param).foldLeft(nonParamBounds(param).lo)(_ | _)
7676

7777
def fullUpperBound(param: TypeParamRef)(implicit actx: AbstractContext): Type =
78-
(nonParamBounds(param).hi /: constraint.minUpper(param))(_ & _)
78+
constraint.minUpper(param).foldLeft(nonParamBounds(param).hi)(_ & _)
7979

8080
/** Full bounds of `param`, including other lower/upper params.
8181
*

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ class Definitions {
382382

383383
// The set of all wrap{X, Ref}Array methods, where X is a value type
384384
val WrapArrayMethods: PerRun[collection.Set[Symbol]] = new PerRun({ implicit ctx =>
385-
val methodNames = ScalaValueTypes.map(ast.tpd.wrapArrayMethodName) + nme.wrapRefArray
385+
val methodNames = ScalaValueTypes.map(ast.tpd.wrapArrayMethodName) `union` Set(nme.wrapRefArray)
386386
methodNames.map(getWrapVarargsArrayModule.requiredMethod(_))
387387
})
388388

@@ -1192,7 +1192,7 @@ class Definitions {
11921192
ByteType, ShortType, CharType, IntType, LongType, FloatType, DoubleType)
11931193

11941194
@tu private lazy val ScalaNumericValueTypes: collection.Set[TypeRef] = ScalaNumericValueTypeList.toSet
1195-
@tu private lazy val ScalaValueTypes: collection.Set[TypeRef] = ScalaNumericValueTypes + UnitType + BooleanType
1195+
@tu private lazy val ScalaValueTypes: collection.Set[TypeRef] = ScalaNumericValueTypes `union` Set(UnitType, BooleanType)
11961196

11971197
val ScalaNumericValueClasses: PerRun[collection.Set[Symbol]] = new PerRun(implicit ctx => ScalaNumericValueTypes.map(_.symbol))
11981198
val ScalaValueClasses: PerRun[collection.Set[Symbol]] = new PerRun(implicit ctx => ScalaValueTypes.map(_.symbol))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ object Flags {
173173
* lie in the given range
174174
*/
175175
private def flagRange(start: Int, end: Int) =
176-
FlagSet((KINDFLAGS.toLong /: (start until end)) ((bits, idx) =>
176+
FlagSet((start until end).foldLeft(KINDFLAGS.toLong) ((bits, idx) =>
177177
if (isDefinedAsFlag(idx)) bits | (1L << idx) else bits))
178178

179179
/** The union of all flags in given flag set */

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,12 +251,12 @@ final class ProperGadtConstraint private(
251251
}
252252

253253
override def fullLowerBound(param: TypeParamRef)(implicit ctx: Context): Type =
254-
(nonParamBounds(param).lo /: constraint.minLower(param)) {
254+
constraint.minLower(param).foldLeft(nonParamBounds(param).lo) {
255255
(t, u) => t | externalize(u)
256256
}
257257

258258
override def fullUpperBound(param: TypeParamRef)(implicit ctx: Context): Type =
259-
(nonParamBounds(param).hi /: constraint.minUpper(param)) {
259+
constraint.minUpper(param).foldLeft(nonParamBounds(param).hi) {
260260
(t, u) => t & externalize(u)
261261
}
262262

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ object NameKinds {
349349
val OuterSelectName: NumberedNameKind = new NumberedNameKind(OUTERSELECT, "OuterSelect") {
350350
def mkString(underlying: TermName, info: ThisInfo) = {
351351
assert(underlying.isEmpty)
352-
info.num + "_<outer>"
352+
s"${info.num}_<outer>"
353353
}
354354
}
355355

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ object NameOps {
271271
}
272272

273273
def unmangle(kinds: List[NameKind]): N = {
274-
val unmangled = (name /: kinds)(_.unmangle(_))
274+
val unmangled = kinds.foldLeft(name)(_.unmangle(_))
275275
if (unmangled eq name) name else unmangled.unmangle(kinds)
276276
}
277277
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ object Names {
164164
override def isTypeName: Boolean = false
165165
override def isTermName: Boolean = true
166166
override def toTermName: TermName = this
167-
override def asTypeName: Nothing = throw new ClassCastException(this + " is not a type name")
167+
override def asTypeName: Nothing = throw new ClassCastException(s"$this is not a type name")
168168
override def asTermName: TermName = this
169169

170170
@sharable // because it is only modified in the synchronized block of toTypeName.
@@ -436,7 +436,7 @@ object Names {
436436
override def isTermName: Boolean = false
437437
override def toTypeName: TypeName = this
438438
override def asTypeName: TypeName = this
439-
override def asTermName: Nothing = throw new ClassCastException(this + " is not a term name")
439+
override def asTermName: Nothing = throw new ClassCastException(s"$this is not a term name")
440440

441441
override def asSimpleName: SimpleName = toTermName.asSimpleName
442442
override def toSimpleName: SimpleName = toTermName.toSimpleName

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,8 @@ class OrderingConstraint(private val boundsMap: ParamBounds,
301301
val lo = normalizedType(bounds.lo, loBuf, isUpper = false)
302302
val hi = normalizedType(bounds.hi, hiBuf, isUpper = true)
303303
current = updateEntry(current, param, bounds.derivedTypeBounds(lo, hi))
304-
current = (current /: loBuf)(order(_, _, param))
305-
current = (current /: hiBuf)(order(_, param, _))
304+
current = loBuf.foldLeft(current)(order(_, _, param))
305+
current = hiBuf.foldLeft(current)(order(_, param, _))
306306
loBuf.clear()
307307
hiBuf.clear()
308308
i += 1
@@ -323,8 +323,8 @@ class OrderingConstraint(private val boundsMap: ParamBounds,
323323
assert(contains(param2), i"$param2")
324324
val newUpper = param2 :: exclusiveUpper(param2, param1)
325325
val newLower = param1 :: exclusiveLower(param1, param2)
326-
val current1 = (current /: newLower)(upperLens.map(this, _, _, newUpper ::: _))
327-
val current2 = (current1 /: newUpper)(lowerLens.map(this, _, _, newLower ::: _))
326+
val current1 = newLower.foldLeft(current)(upperLens.map(this, _, _, newUpper ::: _))
327+
val current2 = newUpper.foldLeft(current1)(lowerLens.map(this, _, _, newLower ::: _))
328328
current2
329329
}
330330

@@ -508,7 +508,7 @@ class OrderingConstraint(private val boundsMap: ParamBounds,
508508
}
509509

510510
def mergeParams(ps1: List[TypeParamRef], ps2: List[TypeParamRef]) =
511-
(ps1 /: ps2)((ps1, p2) => if (ps1.contains(p2)) ps1 else p2 :: ps1)
511+
ps2.foldLeft(ps1)((ps1, p2) => if (ps1.contains(p2)) ps1 else p2 :: ps1)
512512

513513
// Must be symmetric
514514
def mergeEntries(e1: Type, e2: Type): Type =
@@ -679,7 +679,7 @@ class OrderingConstraint(private val boundsMap: ParamBounds,
679679
val assocs =
680680
for (param <- domainParams)
681681
yield
682-
param.binder.paramNames(param.paramNum) + ": " + entryText(entry(param))
682+
s"${param.binder.paramNames(param.paramNum)}: ${entryText(entry(param))}"
683683
assocs.mkString("\n")
684684
}
685685
constrainedText + "\n" + boundsText

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ object StdNames {
116116
val ANON_FUN: N = str.ANON_FUN
117117
val BITMAP_PREFIX: N = "bitmap$" // @darkdimius: $bitmap? Also, the next 4 names are unused.
118118
val BITMAP_NORMAL: N = BITMAP_PREFIX // initialization bitmap for public/protected lazy vals
119-
val BITMAP_TRANSIENT: N = BITMAP_PREFIX + "trans$" // initialization bitmap for transient lazy vals
120-
val BITMAP_CHECKINIT: N = BITMAP_PREFIX + "init$" // initialization bitmap for checkinit values
121-
val BITMAP_CHECKINIT_TRANSIENT: N = BITMAP_PREFIX + "inittrans$" // initialization bitmap for transient checkinit values
119+
val BITMAP_TRANSIENT: N = s"${BITMAP_PREFIX}trans$$" // initialization bitmap for transient lazy vals
120+
val BITMAP_CHECKINIT: N = s"${BITMAP_PREFIX}init$$" // initialization bitmap for checkinit values
121+
val BITMAP_CHECKINIT_TRANSIENT: N = s"${BITMAP_PREFIX}inittrans$$" // initialization bitmap for transient checkinit values
122122
val DEFAULT_GETTER: N = str.DEFAULT_GETTER
123123
val DEFAULT_GETTER_INIT: N = "$lessinit$greater"
124124
val DO_WHILE_PREFIX: N = "doWhile$"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ abstract class SymbolLoader extends LazyType { self =>
331331
else "error while loading " + root.name + ",\n" + msg)
332332
}
333333
try {
334-
val start = currentTime
334+
val start = System.currentTimeMillis
335335
if (Config.tracingEnabled && ctx.settings.YdebugTrace.value)
336336
trace(s">>>> loading ${root.debugString}", _ => s"<<<< loaded ${root.debugString}") {
337337
doComplete(root)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,7 +1724,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
17241724
}
17251725

17261726
/** The greatest lower bound of a list types */
1727-
final def glb(tps: List[Type]): Type = ((AnyType: Type) /: tps)(glb)
1727+
final def glb(tps: List[Type]): Type = tps.foldLeft(AnyType: Type)(glb)
17281728

17291729
def widenInUnions(implicit ctx: Context): Boolean = ctx.scala2Mode || ctx.erasedTypes
17301730

@@ -1767,7 +1767,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
17671767

17681768
/** The least upper bound of a list of types */
17691769
final def lub(tps: List[Type]): Type =
1770-
((NothingType: Type) /: tps)(lub(_,_, canConstrain = false))
1770+
tps.foldLeft(NothingType: Type)(lub(_,_, canConstrain = false))
17711771

17721772
/** Try to produce joint arguments for a lub `A[T_1, ..., T_n] | A[T_1', ..., T_n']` using
17731773
* the following strategies:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,5 +673,5 @@ object TypeOps {
673673
// TODO: Move other typeops here. It's a bit weird that they are a part of `ctx`
674674

675675
def nestedPairs(ts: List[Type])(implicit ctx: Context): Type =
676-
(ts :\ (defn.UnitType: Type))(defn.PairClass.typeRef.appliedTo(_, _))
676+
ts.foldRight(defn.UnitType: Type)(defn.PairClass.typeRef.appliedTo(_, _))
677677
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3154,7 +3154,7 @@ object Types {
31543154
else {
31553155
val result =
31563156
if (paramInfos.isEmpty) NoDeps
3157-
else (NoDeps /: paramInfos.tail)(depStatus(_, _))
3157+
else paramInfos.tail.foldLeft(NoDeps)(depStatus(_, _))
31583158
if ((result & Provisional) == 0) myParamDependencyStatus = result
31593159
(result & StatusMask).toByte
31603160
}
@@ -4235,7 +4235,7 @@ object Types {
42354235

42364236
object AnnotatedType {
42374237
def make(underlying: Type, annots: List[Annotation]): Type =
4238-
(underlying /: annots)(AnnotatedType(_, _))
4238+
annots.foldLeft(underlying)(AnnotatedType(_, _))
42394239
}
42404240

42414241
// Special type objects and classes -----------------------------------------------------

compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ class ClassfileParser(
421421
if (sig(index) != ':') // guard against empty class bound
422422
ts += objToAny(sig2type(tparams, skiptvs))
423423
}
424-
TypeBounds.upper(((NoType: Type) /: ts)(_ & _) orElse defn.AnyType)
424+
TypeBounds.upper(ts.foldLeft(NoType: Type)(_ & _) orElse defn.AnyType)
425425
}
426426

427427
var tparams = classTParams
@@ -878,7 +878,7 @@ class ClassfileParser(
878878
def originalName: SimpleName = pool.getName(name)
879879

880880
override def toString: String =
881-
originalName + " in " + outerName + "(" + externalName + ")"
881+
s"$originalName in $outerName($externalName)"
882882
}
883883

884884
object innerClasses extends scala.collection.mutable.HashMap[Name, InnerClassEntry] {

compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,9 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
355355
val denot1 = denot.disambiguate(p)
356356
val sym = denot1.symbol
357357
if (denot.exists && !denot1.exists) { // !!!DEBUG
358-
val alts = denot.alternatives map (d => d + ":" + d.info + "/" + d.signature)
358+
val alts = denot.alternatives map (d => s"$d:${d.info}/${d.signature}")
359359
System.err.println(s"!!! disambiguation failure: $alts")
360-
val members = denot.alternatives.head.symbol.owner.info.decls.toList map (d => d + ":" + d.info + "/" + d.signature)
360+
val members = denot.alternatives.head.symbol.owner.info.decls.toList map (d => s"$d:${d.info}/${d.signature}")
361361
System.err.println(s"!!! all members: $members")
362362
}
363363
if (tag == EXTref) sym else sym.moduleClass
@@ -773,7 +773,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
773773
if (clazz.isClass) info.substThis(clazz.asClass, rt.recThis)
774774
else info // turns out some symbols read into `clazz` are not classes, not sure why this is the case.
775775
def addRefinement(tp: Type, sym: Symbol) = RefinedType(tp, sym.name, sym.info)
776-
val refined = (parent /: decls.toList)(addRefinement)
776+
val refined = decls.toList.foldLeft(parent)(addRefinement)
777777
RecType.closeOver(rt => subst(refined, rt))
778778
}
779779
case CLASSINFOtpe =>

compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ object JavaParsers {
656656
syntaxError(start, "illegal import", skipIt = false)
657657
List()
658658
} else {
659-
val qual = ((Ident(names.head): Tree) /: names.tail.init) (Select(_, _))
659+
val qual = names.tail.init.foldLeft(Ident(names.head): Tree)(Select(_, _))
660660
val lastname = names.last
661661
val ident = Ident(lastname).withSpan(Span(lastnameOffset))
662662
// val selector = lastname match {

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1455,7 +1455,7 @@ object Parsers {
14551455
t
14561456
}
14571457
case AT if location != Location.InPattern =>
1458-
(t /: annotations())(Annotated)
1458+
annotations().foldLeft(t)(Annotated)
14591459
case _ =>
14601460
val tpt = typeDependingOn(location)
14611461
if (isWildcard(t) && location != Location.InPattern) {

0 commit comments

Comments
 (0)