Skip to content

Commit

Permalink
Merge pull request #9458 from som-snytt/tweak/12320-any
Browse files Browse the repository at this point in the history
  • Loading branch information
lrytz committed Jan 27, 2021
2 parents 0437dc5 + 3ad5c12 commit 4603abc
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/compiler/scala/tools/nsc/symtab/SymbolTrackers.scala
Expand Up @@ -186,15 +186,15 @@ trait SymbolTrackers {
val ownerString = {
val (few, rest) = sym.ownersIterator.splitAt(3)
val ellipsis = Iterator("...").filter(_ => rest.hasNext)
(few ++ ellipsis).mkString(" -> ")
few.map(_.toString).concat(ellipsis).mkString(" -> ")
}
val treeStrings = symMap(sym).map(t => f"${t.shortClass}%10s: $t")

(ownerString :: treeStrings).mkString("\n")
}
def removedString = (removed: List[Symbol]).zipWithIndex map {
def removedString = (removed: List[Symbol]).zipWithIndex.map {
case (t, i) => "(%2s) ".format(i + 1) + detailString(t)
} mkString "\n"
}.mkString("\n")

"" + hierarchy + (
if (removed.isEmpty) ""
Expand Down
Expand Up @@ -320,7 +320,7 @@ trait MatchTreeMaking extends MatchCodeGen with Debugging {
}
}

override def toString = "P"+((prevBinder.name, extraCond getOrElse "", localSubstitution))
override def toString = s"P(${prevBinder.name}, ${extraCond.fold("")(_.toString)}, ${localSubstitution})"
}

object IrrefutableExtractorTreeMaker {
Expand Down
Expand Up @@ -107,7 +107,7 @@ trait TypersTracking {
def showPush(tree: Tree, mode: Mode, pt: Type, context: Context): Unit = {
def tree_s = truncAndOneLine(ptTree(tree))
def pt_s = if (pt.isWildcard || context.inTypeConstructorAllowed) "" else s": pt=$pt"
def all_s = List(tree_s, pt_s, mode, fullSiteString(context)) filterNot (_ == "") mkString " "
def all_s = List(tree_s, pt_s, mode.toString, fullSiteString(context)).filterNot(_.isEmpty).mkString(" ")

atLowerIndent(show(indented("""|-- """ + all_s)))
}
Expand Down
2 changes: 1 addition & 1 deletion src/library/scala/collection/Seq.scala
Expand Up @@ -514,7 +514,7 @@ trait SeqOps[+A, +CC[_], +C] extends Any
* @return `true` if this $coll contains a slice with the same elements
* as `that`, otherwise `false`.
*/
def containsSlice[B](that: Seq[B]): Boolean = indexOfSlice(that) != -1
def containsSlice[B >: A](that: Seq[B]): Boolean = indexOfSlice(that) != -1

/** Tests whether this $coll contains a given value as an element.
* $mayNotTerminateInf
Expand Down
Expand Up @@ -170,7 +170,7 @@ object ScalaSigEntryParsers extends RulesWithState with MemoisableRules {
val index = read(_.index)
val key = read(_.entryType)

lazy val entry: EntryParser[Any] = symbol | typeEntry | literal | name | attributeInfo | annotInfo | children | get
lazy val entry: EntryParser[Any] = (symbol: EntryParser[Any]) | typeEntry | literal | name | attributeInfo | annotInfo | children | get

val ref = byteCodeEntryParser(nat)

Expand Down
2 changes: 1 addition & 1 deletion test/junit/scala/collection/IterableTest.scala
Expand Up @@ -270,7 +270,7 @@ class IterableTest {

@Test
def partitionMap(): Unit = {
val (left, right) = Seq(1, "1", 2, "2", 3, "3", 4, "4", 5, "5").partitionMap {
val (left, right) = Seq[Any](1, "1", 2, "2", 3, "3", 4, "4", 5, "5").partitionMap {
case i: Int => Left(i)
case s: String => Right(s)
}
Expand Down
4 changes: 2 additions & 2 deletions test/junit/scala/collection/MapTest.scala
Expand Up @@ -50,8 +50,8 @@ class MapTest {
val m = (1 to 10).map(x => (x, x)).toMap
val m1 = m ++: m
assertEquals(m.toList.sorted, (m1: Map[Int, Int]).toList.sorted)
val s1 = List(1) ++: m
assertEquals(1 :: m.toList.sorted, (s1: Iterable[Any]).toList.sortBy({case (x: Int, _) => x; case x: Int => x}))
val s1: Iterable[Any] = List(1) ++: m
assertEquals(1 :: m.toList.sorted, s1.toList.sortBy { case (x: Int, _) => x ; case x: Int => x })
}

@Test
Expand Down
8 changes: 4 additions & 4 deletions test/junit/scala/collection/SetMapConsistencyTest.scala
Expand Up @@ -307,11 +307,11 @@ class SetMapConsistencyTest {


// Actual tests
val smallKeys = Array(0, 1, 42, 9127)
val intKeys = smallKeys ++ Array(-1, Int.MaxValue, Int.MinValue, -129385)
val longKeys = intKeys.map(_.toLong) ++ Array(Long.MaxValue, Long.MinValue, 1397198789151L, -41402148014L)
val smallKeys = Array(0, 1, 42, 9127)
val intKeys = smallKeys ++ Array(-1, Int.MaxValue, Int.MinValue, -129385)
val longKeys = intKeys.map(_.toLong) ++ Array(Long.MaxValue, Long.MinValue, 1397198789151L, -41402148014L)
val stringKeys = intKeys.map(_.toString) ++ Array("", null)
val anyKeys = stringKeys.filter(_ != null) ++ Array(0L) ++ Array(true) ++ Array(math.Pi)
val anyKeys = (stringKeys.filter(_ != null) ++ Array(0L): Array[Any]) ++ Array(true) ++ Array(math.Pi)

@Test
def churnIntMaps(): Unit = {
Expand Down

0 comments on commit 4603abc

Please sign in to comment.