From f80801c67545a28f61abd1a36a5ef8b5bc337d87 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Wed, 16 Mar 2011 06:31:59 +0000 Subject: Deprecation patrol. warnings due to my changing a map from mutable to immutable (which ought to be the good direction) because "def update" still lingers on immutable maps. I counted the days elapsed since it was marked for death (before 2.8.0) and added in the bugliness of what I was looking at and bid it farewell. Now removed: def update on immutable maps. No review. --- src/compiler/scala/tools/nsc/CompileServer.scala | 2 +- src/compiler/scala/tools/nsc/MainGenericRunner.scala | 3 +-- src/compiler/scala/tools/nsc/doc/html/page/Template.scala | 8 ++++---- src/compiler/scala/tools/nsc/interpreter/ILoop.scala | 7 +++---- src/compiler/scala/tools/nsc/symtab/clr/TypeParser.scala | 7 ++++++- src/library/scala/collection/immutable/IntMap.scala | 3 --- src/library/scala/collection/immutable/LongMap.scala | 3 --- src/library/scala/collection/immutable/MapLike.scala | 6 +----- src/library/scala/collection/immutable/TrieIteratorBase.scala | 2 +- src/partest/scala/tools/partest/utils/Properties.scala | 2 +- test/files/neg/bug1181.check | 2 +- test/files/neg/bug1181.scala | 2 +- test/files/run/map_test.scala | 10 +++++----- 13 files changed, 25 insertions(+), 32 deletions(-) diff --git a/src/compiler/scala/tools/nsc/CompileServer.scala b/src/compiler/scala/tools/nsc/CompileServer.scala index b6e9ab33d5..34b515cf21 100644 --- a/src/compiler/scala/tools/nsc/CompileServer.scala +++ b/src/compiler/scala/tools/nsc/CompileServer.scala @@ -180,6 +180,6 @@ object CompileServer extends StandardCompileServer { run() compileSocket.deletePort(port) - exit(0) + sys.exit(0) } } diff --git a/src/compiler/scala/tools/nsc/MainGenericRunner.scala b/src/compiler/scala/tools/nsc/MainGenericRunner.scala index 001b93d28f..ad7cde1e30 100644 --- a/src/compiler/scala/tools/nsc/MainGenericRunner.scala +++ b/src/compiler/scala/tools/nsc/MainGenericRunner.scala @@ -73,8 +73,7 @@ object MainGenericRunner { else command.thingToRun match { case None => // We start the repl when no arguments are given. - new ILoop main settings - true // not actually reached in general + new ILoop process settings case Some(thingToRun) => val isObjectName = diff --git a/src/compiler/scala/tools/nsc/doc/html/page/Template.scala b/src/compiler/scala/tools/nsc/doc/html/page/Template.scala index 481cfac6f6..19372d9e7c 100644 --- a/src/compiler/scala/tools/nsc/doc/html/page/Template.scala +++ b/src/compiler/scala/tools/nsc/doc/html/page/Template.scala @@ -63,13 +63,13 @@ class Template(tpl: DocTemplateEntity) extends HtmlPage {
- { if (tpl.linearization.isEmpty) NodeSeq.Empty else + { if (tpl.linearizationTemplates.isEmpty) NodeSeq.Empty else
Ordering
  1. Alphabetic
  2. By inheritance
} - { if (tpl.linearization.isEmpty) NodeSeq.Empty else + { if (tpl.linearizationTemplates.isEmpty) NodeSeq.Empty else
Inherited
  1. Hide All
  2. Show all
@@ -112,7 +112,7 @@ class Template(tpl: DocTemplateEntity) extends HtmlPage { } { - NodeSeq fromSeq (for ((superTpl, superType) <- tpl.linearization) yield + NodeSeq fromSeq (for ((superTpl, superType) <- (tpl.linearizationTemplates zip tpl.linearizationTypes)) yield

Inherited from { if (tpl.universe.settings.useStupidTypes.value) @@ -292,7 +292,7 @@ class Template(tpl: DocTemplateEntity) extends HtmlPage { } } ++ { mbr match { - case dtpl: DocTemplateEntity if (isSelf && !dtpl.linearization.isEmpty && !isReduced) => + case dtpl: DocTemplateEntity if (isSelf && !dtpl.linearizationTemplates.isEmpty && !isReduced) =>
linear super types: { typesToHtml(dtpl.linearizationTypes, hasLinks = true, sep = xml.Text(", ")) }
diff --git a/src/compiler/scala/tools/nsc/interpreter/ILoop.scala b/src/compiler/scala/tools/nsc/interpreter/ILoop.scala index 3153323858..53a3448c20 100644 --- a/src/compiler/scala/tools/nsc/interpreter/ILoop.scala +++ b/src/compiler/scala/tools/nsc/interpreter/ILoop.scala @@ -734,10 +734,9 @@ class ILoop(in0: Option[BufferedReader], protected val out: PrintWriter) // if they asked for no help and command is valid, we call the real main neededHelp() match { - case "" => if (command.ok) main(command.settings) // else nothing - case help => plush(help) + case "" => command.ok && process(command.settings) + case help => plush(help) ; true } - true } @deprecated("Use `process` instead") @@ -763,7 +762,7 @@ object ILoop { val settings = new Settings settings.classpath.value = sys.props("java.class.path") - repl main settings + repl process settings } } } diff --git a/src/compiler/scala/tools/nsc/symtab/clr/TypeParser.scala b/src/compiler/scala/tools/nsc/symtab/clr/TypeParser.scala index dae58d3656..37b81a8fc1 100644 --- a/src/compiler/scala/tools/nsc/symtab/clr/TypeParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/clr/TypeParser.scala @@ -92,7 +92,12 @@ abstract class TypeParser { val flags = Flags.JAVA | Flags.STATIC | Flags.IMPLICIT; // todo: static? shouldn't be final instead? val viewMethodType = (msym: Symbol) => JavaMethodType(msym.newSyntheticValueParams(List(fromTpe)), toTpe) val vmsym = createMethod(nme.view_ + viewSuffix, flags, viewMethodType, null, true); - if (addToboxMethodMap) definitions.boxMethod(clazz) = vmsym + // !!! this used to mutate a mutable map in definitions, but that map became + // immutable and this kept "working" with a no-op. So now it's commented out + // since I retired the deprecated code which allowed for that bug. + // + // if (addToboxMethodMap) definitions.boxMethod(clazz) = vmsym + if (isAddressOf) clrTypes.addressOfViews += vmsym vmsym } diff --git a/src/library/scala/collection/immutable/IntMap.scala b/src/library/scala/collection/immutable/IntMap.scala index e96b9252ea..140ba4dbec 100644 --- a/src/library/scala/collection/immutable/IntMap.scala +++ b/src/library/scala/collection/immutable/IntMap.scala @@ -269,9 +269,6 @@ sealed abstract class IntMap[+T] extends Map[Int, T] with MapLike[Int, T, IntMap case IntMap.Nil => IntMap.Tip(key, value); } - @deprecated("use `updated' instead") - override def update[S >: T](key: Int, value: S): IntMap[S] = updated(key, value) - /** * Updates the map, using the provided function to resolve conflicts if the key is already present. * diff --git a/src/library/scala/collection/immutable/LongMap.scala b/src/library/scala/collection/immutable/LongMap.scala index 30a15abfa9..d5f1374540 100644 --- a/src/library/scala/collection/immutable/LongMap.scala +++ b/src/library/scala/collection/immutable/LongMap.scala @@ -267,9 +267,6 @@ sealed abstract class LongMap[+T] extends Map[Long, T] with MapLike[Long, T, Lon case LongMap.Nil => LongMap.Tip(key, value); } - @deprecated("use `updated' instead") - override def update[S >: T](key: Long, value: S): LongMap[S] = updated(key, value) - /** * Updates the map, using the provided function to resolve conflicts if the key is already present. * diff --git a/src/library/scala/collection/immutable/MapLike.scala b/src/library/scala/collection/immutable/MapLike.scala index 7a3f63d481..a0f1632d1e 100644 --- a/src/library/scala/collection/immutable/MapLike.scala +++ b/src/library/scala/collection/immutable/MapLike.scala @@ -6,8 +6,6 @@ ** |/ ** \* */ - - package scala.collection package immutable @@ -124,7 +122,5 @@ trait MapLike[A, +B, +This <: MapLike[A, B, This] with Map[A, B]] for ((key, value) <- this) b += ((key, f(key, value))) b.result } - - @deprecated("use `updated' instead") - def update[B1 >: B](key: A, value: B1): immutable.Map[A, B1] = updated(key, value).asInstanceOf[immutable.Map[A, B1]] } + diff --git a/src/library/scala/collection/immutable/TrieIteratorBase.scala b/src/library/scala/collection/immutable/TrieIteratorBase.scala index b14a39db7e..02126b456f 100644 --- a/src/library/scala/collection/immutable/TrieIteratorBase.scala +++ b/src/library/scala/collection/immutable/TrieIteratorBase.scala @@ -168,7 +168,7 @@ private[immutable] abstract class TrieIteratorBase[+T, CC >: Null <: Iterable[T] val arr: Array[CC] = determineType(m) match { case COLLISION_TYPE => collisionToArray(m) case TRIE_TYPE => getElems(m) - case _ => error("cannot divide single element") + case _ => sys.error("cannot divide single element") } arrayToIterators(arr) } diff --git a/src/partest/scala/tools/partest/utils/Properties.scala b/src/partest/scala/tools/partest/utils/Properties.scala index 8312d8fde6..b8a6ec8007 100644 --- a/src/partest/scala/tools/partest/utils/Properties.scala +++ b/src/partest/scala/tools/partest/utils/Properties.scala @@ -13,5 +13,5 @@ package utils /** Loads partest.properties from the jar. */ object Properties extends scala.util.PropertiesTrait { protected def propCategory = "partest" - protected def pickJarBasedOn = classOf[Application] + protected def pickJarBasedOn = classOf[nest.Worker] } diff --git a/test/files/neg/bug1181.check b/test/files/neg/bug1181.check index 38045eda87..a196a702ab 100644 --- a/test/files/neg/bug1181.check +++ b/test/files/neg/bug1181.check @@ -1,4 +1,4 @@ bug1181.scala:9: error: missing parameter type - _ => buildMap(map.update(keyList.head, valueList.head), keyList.tail, valueList.tail) + _ => buildMap(map.updated(keyList.head, valueList.head), keyList.tail, valueList.tail) ^ one error found diff --git a/test/files/neg/bug1181.scala b/test/files/neg/bug1181.scala index fbbb2a84d4..5e5fceacc8 100644 --- a/test/files/neg/bug1181.scala +++ b/test/files/neg/bug1181.scala @@ -6,7 +6,7 @@ class CompilerTest(val valueList: List[Symbol]) { def buildMap(map: Map[Symbol, Symbol], keyList: List[Symbol], valueList: List[Symbol]): Map[Symbol, Symbol] = { (keyList, valueList) match { case (Nil, Nil) => map - _ => buildMap(map.update(keyList.head, valueList.head), keyList.tail, valueList.tail) + _ => buildMap(map.updated(keyList.head, valueList.head), keyList.tail, valueList.tail) } } } diff --git a/test/files/run/map_test.scala b/test/files/run/map_test.scala index 9f83a3f49a..1ea864ed58 100644 --- a/test/files/run/map_test.scala +++ b/test/files/run/map_test.scala @@ -16,15 +16,15 @@ object Test extends App { } def test_map(myMap: Map[Int, String]) { - val map1 = myMap.update(42,"The answer") - val map2 = map1.update(17,"A small random number") - val map3 = map2.update(666,"A bigger random number") - val map4 = map3.update(4711,"A big random number") + val map1 = myMap.updated(42,"The answer") + val map2 = map1.updated(17,"A small random number") + val map3 = map2.updated(666,"A bigger random number") + val map4 = map3.updated(4711,"A big random number") map1 == myMap + Pair(42, "The answer") var i = 0 var map = map4 while(i < 43) { - map = map.update(i,i.toString()) + map = map.updated(i,i.toString()) i += 1 } i = 0 -- cgit v1.2.3