Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump pprint to 0.7.1 #151

Merged
merged 2 commits into from
Jan 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ jobs:
- run: ./bin/scalafmt --check
- run: sbt scalafixCheckAll
- run: sbt coreJVM/mimaReportBinaryIssues
- run: sbt docs/docusaurusCreateSite
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: olafurpg/setup-scala@v13
- uses: olafurpg/setup-gpg@v3
- name: Publish ${{ github.ref }}
run: sbt ci-release docs/docusaurusPublishGhpages
run: sbt ci-release
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
Expand Down
8 changes: 3 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,9 @@ lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform)
moduleName := "metaconfig-core",
libraryDependencies ++= List(
"org.typelevel" %%% "paiges-core" % "0.4.2",
"org.scala-lang.modules" %%% "scala-collection-compat" % "2.5.0"
) :+ (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 11)) => "com.lihaoyi" %%% "pprint" % "0.5.4"
case _ => "com.lihaoyi" %%% "pprint" % "0.6.6"
})
"org.scala-lang.modules" %%% "scala-collection-compat" % "2.5.0",
"com.lihaoyi" %%% "pprint" % "0.7.1"
)
)
.settings(
libraryDependencies += {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ class Macros(val c: blackbox.Context) {

val field = q"""new ${weakTypeOf[Field]}(
${param.name.decodedName.toString},
$tpeString.render,
$tpeString.render.render,
_root_.scala.List.apply(..$finalAnnots),
$underlying
)"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ private[generic] def deriveSurfaceImpl[T: Type](using q: Quotes) =
fieldType.asType match
case '[t] =>
val renderer = Expr.summon[pprint.TPrint[t]].get
'{ $renderer.render }
'{ $renderer.render.render }

val fieldExpr = '{
new Field($fieldName, $tpeString, $finalAnnots, $underlying)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package metaconfig
import java.io.File
import metaconfig.generic.Settings
import metaconfig.generic.Surface
import pprint.TPrintColors

class DeriveSurfaceSuite extends munit.FunSuite {

Expand Down Expand Up @@ -76,13 +77,20 @@ class DeriveSurfaceSuite extends munit.FunSuite {
case class CustomTypePrinting(a: Int, b: Option[Int], c: List[String])
test("tprint") {
import pprint.TPrint
implicit val intPrint = TPrint.literal[Int]("number")
implicit val intPrint = new TPrint[Int] {
def render(implicit tpc: TPrintColors): fansi.Str = fansi.Str("number")
}
implicit def optionPrint[T](implicit ev: TPrint[T]): TPrint[Option[T]] =
TPrint.make { implicit colors => "(" + ev.render + ")" }
new TPrint[Option[T]] {
def render(implicit tpc: TPrintColors): fansi.Str =
"(" + ev.render + ")"
}
implicit def iterablePrint[C[x] <: Iterable[x], T](
implicit ev: TPrint[T]
): TPrint[C[T]] =
TPrint.make { implicit colors => "[" + ev.render + " ...]" }
): TPrint[C[T]] = new TPrint[C[T]] {
def render(implicit tpc: TPrintColors): fansi.Str =
"[" + ev.render + " ...]"
}
implicit val surface = generic.deriveSurface[CustomTypePrinting]
val a :: b :: c :: Nil = Settings[CustomTypePrinting].settings
assertEquals(a.tpe, "number")
Expand Down