Skip to content

Commit 0099330

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

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
*

0 commit comments

Comments
 (0)