Skip to content

Commit d35f831

Browse files
committed
Use collection prefix from toString for ColCompatHelper's className implementation of Scala 2.13.0-M5.
1 parent 0a45eaf commit d35f831

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

project/GenColCompatHelper.scala

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,14 @@ object GenColCompatHelper {
5555
|
5656
| object Factory {}
5757
|
58-
| def className(col: scala.collection.Iterable[_]): String = org.scalactic.NameUtil.getSimpleNameOfAnObjectsClass(col)
58+
| def className(col: scala.collection.Iterable[_]): String = {
59+
| val colToString = col.toString
60+
| val bracketIdx = colToString.indexOf("(")
61+
| if (bracketIdx >= 0)
62+
| colToString.take(bracketIdx)
63+
| else
64+
| org.scalactic.NameUtil.getSimpleNameOfAnObjectsClass(col)
65+
| }
5966
|
6067
| def newBuilder[A, C](f: Factory[A, C]): scala.collection.mutable.Builder[A, C] = f.newBuilder
6168
|

scalactic/src/main/scala/org/scalactic/Prettifier.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,7 @@ object Prettifier {
205205
case anArray: Array[_] => "Array(" + (anArray map apply).mkString(", ") + ")"
206206
case aWrappedArray: WrappedArray[_] => "Array(" + (aWrappedArray map apply).mkString(", ") + ")"
207207
case anArrayOps if ArrayHelper.isArrayOps(anArrayOps) => "Array(" + (ArrayHelper.asArrayOps(anArrayOps) map apply).mkString(", ") + ")"
208-
case aList: List[_] => "List(" + (aList map apply).mkString(", ") + ")"
209-
case aGenMap: GenMap[_, _] =>
208+
case aGenMap: scala.collection.GenMap[_, _] =>
210209
ColCompatHelper.className(aGenMap) + "(" +
211210
(aGenMap.toIterator.map { case (key, value) => // toIterator is needed for consistent ordering
212211
apply(key) + " -> " + apply(value)

0 commit comments

Comments
 (0)