Skip to content

Commit

Permalink
add type-details:4 case where both prefix context & existential conte…
Browse files Browse the repository at this point in the history
…xt are printed
  • Loading branch information
tribbloid committed Sep 21, 2023
1 parent 31c8e80 commit 842e8cc
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions core/src/main/scala-2.13.7+/latest/splain/TyperCompatViews.scala
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,36 @@ trait TyperCompatViews {
val details = pluginSettings.typeDetails.getOrElse(1)

lazy val short = self.safeToString
lazy val long = self.toLongString
lazy val long = scala.util.Try(self.toLongString).getOrElse(short)

lazy val ec = existentialContext(self)

lazy val pc =
if (long.startsWith(prefixFullName)) ""
else {
s" {$prefixContext}"
}

lazy val withEc = scala.util
.Try(
long + ec
)
.getOrElse(long)

lazy val withPcEc = scala.util
.Try(
long + pc + ec
)
.getOrElse(withEc)

if (details <= 1) {
short
} else if (details == 2) {
scala.util.Try(long).getOrElse(short)
long
} else if (details == 3) {
withEc
} else {
scala.util
.Try(
long + ec
)
.orElse(scala.util.Try(long))
.orElse(scala.util.Try(short + ec))
.getOrElse(short)
withPcEc
}
}
}
Expand Down

0 comments on commit 842e8cc

Please sign in to comment.