Skip to content

Commit

Permalink
Workaround bad implicit conversion
Browse files Browse the repository at this point in the history
`prettyAny` defines an implicit conversion from `Any` to `Pretty`, this
is really dangerous in general. Here the problem is that `Pretty` has a
`map` member, so Dotty ends up choosing this conversion when we call
`map` on an array. We work around this by first converting the array to
a list, but the implicit conversions in this file should really be
rethought.
  • Loading branch information
smarter committed Aug 20, 2019
1 parent 3d755cf commit b06de52
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/scala/org/scalacheck/util/Pretty.scala
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ object Pretty {
}

implicit def prettyThrowable(e: Throwable): Pretty = Pretty { prms =>
val strs = e.getStackTrace.map { st =>
val strs = e.getStackTrace.toList.map { st =>
import st._
getClassName+"."+getMethodName + "("+getFileName+":"+getLineNumber+")"
}

val strs2 =
if(prms.verbosity <= 0) Array[String]()
if(prms.verbosity <= 0) List[String]()
else if(prms.verbosity <= 1) strs.take(5)
else strs

Expand Down

0 comments on commit b06de52

Please sign in to comment.