Skip to content

Commit

Permalink
simplify formatDiffImpl
Browse files Browse the repository at this point in the history
  • Loading branch information
tribbloid committed Sep 22, 2023
1 parent 591fa95 commit ce9ab40
Showing 1 changed file with 20 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,26 @@ trait SplainFormattingExtension extends typechecker.splain.SplainFormatting with
if (noArgs.distinct.size == 1) {
formatDiffInfix(left, right, top)
} else {
formatDiffSpecial(left, right, top).getOrElse(formatDiffSimple(left, right))
formatDiffSpecial(left, right, top).getOrElse {

val result = formatDiffSimple(left, right)

result match {
case diff: Diff =>
val noApparentDiff = diff.left == diff.right

if (noApparentDiff) {

ExplainDiff(
diff,
TypeDiffView(left, right).builtInDiffMsg
).index()
}
case _ =>
}

result
}
}
}

Expand Down Expand Up @@ -578,26 +597,6 @@ trait SplainFormattingExtension extends typechecker.splain.SplainFormatting with
}
}

override def formatDiffSimple(left: Type, right: Type): Formatted = {

val result = super.formatDiffSimple(left, right)

result match {
case diff: Diff =>
val noApparentDiff = diff.left == diff.right

if (noApparentDiff) {

ExplainDiff(
diff,
TypeDiffView(left, right).builtInDiffMsg
).index()
}
}

result
}

override def showFormattedLImpl(ft: Formatted, break: Boolean): TypeRepr = {

/**
Expand Down

0 comments on commit ce9ab40

Please sign in to comment.