diff options
Diffstat (limited to 'src/compiler')
9 files changed, 24 insertions, 24 deletions
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala index cd9bbc6127..9e1c034f86 100644 --- a/src/compiler/scala/tools/nsc/Interpreter.scala +++ b/src/compiler/scala/tools/nsc/Interpreter.scala @@ -1204,7 +1204,7 @@ object Interpreter { (implicit bf: CanBuildFrom[CC[A], B, CC[B]]) = { val b = bf(coll) - for (x <- coll partialMap pf) + for (x <- coll collect pf) b ++= x b.result diff --git a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala index f7fe5678fe..41de091055 100644 --- a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala +++ b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala @@ -177,11 +177,11 @@ class ModelFactory(val global: Global, val settings: doc.Settings) extends Comme // Only this class's constructors are part of its members, inherited constructors are not. sym.info.nonPrivateMembers.filter(x => (!x.isConstructor || x.owner==sym)) val members = memberSyms flatMap (makeMember(_, this)) - val templates = members partialMap { case c: DocTemplateEntity => c } - val methods = members partialMap { case d: Def => d } - val values = members partialMap { case v: Val => v } - val abstractTypes = members partialMap { case t: AbstractType => t } - val aliasTypes = members partialMap { case t: AliasType => t } + val templates = members collect { case c: DocTemplateEntity => c } + val methods = members collect { case d: Def => d } + val values = members collect { case v: Val => v } + val abstractTypes = members collect { case t: AbstractType => t } + val aliasTypes = members collect { case t: AliasType => t } override def isTemplate = true def isDocTemplate = true def companion = sym.companionSymbol match { @@ -193,7 +193,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) extends Comme abstract class PackageImpl(sym: Symbol, inTpl: => PackageImpl) extends DocTemplateImpl(sym, inTpl) with Package { override def inTemplate = inTpl override def toRoot: List[PackageImpl] = this :: inTpl.toRoot - val packages = members partialMap { case p: Package => p } + val packages = members collect { case p: Package => p } } abstract class RootPackageImpl(sym: Symbol) extends PackageImpl(sym, null) with RootPackageEntity @@ -304,7 +304,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) extends Comme def valueParams = List(sym.constrParamAccessors map (makeValueParam(_, this))) val constructors = - members partialMap { case d: Constructor => d } + members collect { case d: Constructor => d } def primaryConstructor = (constructors find (_.isPrimary)) def isCaseClass = sym.isClass && sym.hasFlag(Flags.CASE) } diff --git a/src/compiler/scala/tools/nsc/interpreter/PackageCompletion.scala b/src/compiler/scala/tools/nsc/interpreter/PackageCompletion.scala index b75c0ca765..26ae4106c6 100644 --- a/src/compiler/scala/tools/nsc/interpreter/PackageCompletion.scala +++ b/src/compiler/scala/tools/nsc/interpreter/PackageCompletion.scala @@ -141,7 +141,7 @@ object PackageCompletion { * will look only in the scalaHome directories, which is most of what we want. */ def isUnderScalaHome(d: Directory) = d.parents exists (_ == scalaHomeDir) - val dirs = cp partialMap { case x: Directory => x } filter isUnderScalaHome + val dirs = cp collect { case x: Directory => x } filter isUnderScalaHome // for e.g. foo.bar.baz.C, returns (foo -> bar), (foo.bar -> baz), (foo.bar.baz -> C) // and scala.Range$BigInt needs to go scala -> Range -> BigInt diff --git a/src/compiler/scala/tools/nsc/io/AbstractFile.scala b/src/compiler/scala/tools/nsc/io/AbstractFile.scala index 04aa661bd6..079b33c2a2 100644 --- a/src/compiler/scala/tools/nsc/io/AbstractFile.scala +++ b/src/compiler/scala/tools/nsc/io/AbstractFile.scala @@ -56,7 +56,7 @@ object AbstractFile * @return ... */ def getURL(url: URL): AbstractFile = - Option(url) partialMap { case url: URL if Path.isJarOrZip(url.getPath) => ZipArchive fromURL url } orNull + Option(url) collect { case url: URL if Path.isJarOrZip(url.getPath) => ZipArchive fromURL url } orNull } /** diff --git a/src/compiler/scala/tools/nsc/io/Directory.scala b/src/compiler/scala/tools/nsc/io/Directory.scala index 822dfbdffe..b8ce6e5355 100644 --- a/src/compiler/scala/tools/nsc/io/Directory.scala +++ b/src/compiler/scala/tools/nsc/io/Directory.scala @@ -50,8 +50,8 @@ class Directory(jfile: JFile) extends Path(jfile) { case xs => xs.iterator map Path.apply } - def dirs: Iterator[Directory] = list partialMap { case x: Directory => x } - def files: Iterator[File] = list partialMap { case x: File => x } + def dirs: Iterator[Directory] = list collect { case x: Directory => x } + def files: Iterator[File] = list collect { case x: File => x } def deepDirs: Iterator[Directory] = Path.onlyDirs(deepList()) def deepFiles: Iterator[File] = Path.onlyFiles(deepList()) @@ -68,7 +68,7 @@ class Directory(jfile: JFile) extends Path(jfile) { * to the (optionally) given depth. */ def subdirs(depth: Int = 1): Iterator[Directory] = - deepList(depth) partialMap { case x: Directory => x } + deepList(depth) collect { case x: Directory => x } /** Deletes the directory recursively. Returns false on failure. * Use with caution! diff --git a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala index ab7b9adf72..d4a920008f 100644 --- a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala +++ b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala @@ -149,7 +149,7 @@ trait ParallelMatching extends ast.TreeDSL if (!scrut.isSimple) None else { val (_lits, others) = ps span isSwitchableConst - val lits = _lits partialMap { case x: LiteralPattern => x } + val lits = _lits collect { case x: LiteralPattern => x } condOpt(others) { case Nil => new PatternSwitch(scrut, lits, None) diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala index e92fd28026..b36272bd18 100644 --- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala +++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala @@ -455,18 +455,18 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable => } def isDeprecated = hasAnnotation(DeprecatedAttr) - def deprecationMessage = getAnnotationArg(DeprecatedAttr, 0) partialMap { case Literal(const) => const.stringValue } + def deprecationMessage = getAnnotationArg(DeprecatedAttr, 0) collect { case Literal(const) => const.stringValue } // !!! when annotation arguments are not literal strings, but any sort of // assembly of strings, there is a fair chance they will turn up here not as // Literal(const) but some arbitrary AST. However nothing in the compiler // prevents someone from writing a @migration annotation with a calculated // string. So this needs attention. For now the fact that migration is // private[scala] ought to provide enough protection. - def migrationMessage = getAnnotationArg(MigrationAnnotationClass, 2) partialMap { + def migrationMessage = getAnnotationArg(MigrationAnnotationClass, 2) collect { case Literal(const) => const.stringValue case x => x.toString // should not be necessary, but better than silently ignoring an issue } - def elisionLevel = getAnnotationArg(ElidableMethodClass, 0) partialMap { case Literal(Constant(x: Int)) => x } + def elisionLevel = getAnnotationArg(ElidableMethodClass, 0) collect { case Literal(Constant(x: Int)) => x } /** Does this symbol denote a wrapper object of the interpreter or its class? */ final def isInterpreterWrapper = diff --git a/src/compiler/scala/tools/nsc/util/ClassPath.scala b/src/compiler/scala/tools/nsc/util/ClassPath.scala index 0560062bf1..9ec9bf584f 100644 --- a/src/compiler/scala/tools/nsc/util/ClassPath.scala +++ b/src/compiler/scala/tools/nsc/util/ClassPath.scala @@ -32,7 +32,7 @@ object ClassPath { /** Get all jars in directory */ def lsJars(dir: Directory, filt: String => Boolean = _ => true) = - dir.files partialMap { case f if filt(f.name) && (f hasExtension "jar") => f.path } toList + dir.files collect { case f if filt(f.name) && (f hasExtension "jar") => f.path } toList def basedir(s: String) = if (s contains File.separator) s.substring(0, s.lastIndexOf(File.separator)) @@ -283,11 +283,11 @@ class SourcePath[T](dir: AbstractFile, val context: ClassPathContext[T]) extends def asURLs = dir.sfile.toList map (_.toURL) val sourcepaths: List[AbstractFile] = List(dir) - lazy val classes: List[ClassRep] = dir partialMap { + lazy val classes: List[ClassRep] = dir collect { case f if !f.isDirectory && validSourceFile(f.name) => ClassRep(None, Some(f)) } toList - lazy val packages: List[SourcePath[T]] = dir partialMap { + lazy val packages: List[SourcePath[T]] = dir collect { case f if f.isDirectory && validPackage(f.name) => new SourcePath[T](f, context) } toList @@ -304,11 +304,11 @@ class DirectoryClassPath(val dir: AbstractFile, val context: ClassPathContext[Ab def asURLs = dir.sfile.toList map (_.toURL) val sourcepaths: List[AbstractFile] = Nil - lazy val classes: List[ClassRep] = dir partialMap { + lazy val classes: List[ClassRep] = dir collect { case f if !f.isDirectory && validClassFile(f.name) => ClassRep(Some(f), None) } toList - lazy val packages: List[DirectoryClassPath] = dir partialMap { + lazy val packages: List[DirectoryClassPath] = dir collect { case f if f.isDirectory && validPackage(f.name) => new DirectoryClassPath(f, context) } toList @@ -393,7 +393,7 @@ extends ClassPath[T] { }) } - def asClasspathString: String = join(entries partialMap { + def asClasspathString: String = join(entries collect { case x: DirectoryClassPath => x.dir.path case x: MergedClassPath[_] => x.asClasspathString }: _*) diff --git a/src/compiler/scala/tools/util/BashCompletion.scala b/src/compiler/scala/tools/util/BashCompletion.scala index ad7c1136ca..ed9f1b505a 100644 --- a/src/compiler/scala/tools/util/BashCompletion.scala +++ b/src/compiler/scala/tools/util/BashCompletion.scala @@ -85,7 +85,7 @@ _scala_commands import settings._ val phaseNames = "all" :: (new Global(settings) phaseNames) - val phaseSettings = settings.visibleSettings partialMap { case x: PhasesSetting => "\"" + x.name + "\"" } + val phaseSettings = settings.visibleSettings collect { case x: PhasesSetting => "\"" + x.name + "\"" } def settingStrings(s: Setting, expanded: Boolean) = s match { case x: ChoiceSetting => if (expanded) x.choices map (x.name + ":" + _) else List(x.name + ":") |