Skip to content

Commit 5340d89

Browse files
authored
Merge pull request #12553 from lampepfl/scaladoc/match-errors-fix
Scaladoc: Handle types that were throwing match errors
2 parents 7599095 + 63ee9c5 commit 5340d89

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

scaladoc/src/dotty/tools/scaladoc/tasty/TypesSupport.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,20 @@ trait TypesSupport:
272272

273273
case RecursiveType(tp) => inner(tp)
274274

275+
case MatchCase(pattern, rhs) =>
276+
texts("case ") ++ inner(pattern) ++ texts(" => ") ++ inner(rhs)
277+
278+
case t: dotty.tools.dotc.core.Types.LazyRef => try {
279+
inner(t.ref(using ctx.compilerContext).asInstanceOf[TypeRepr])
280+
} catch {
281+
case e: AssertionError => texts("LazyRef(...)")
282+
}
283+
284+
case tpe =>
285+
val msg = s"Encountered unsupported type. Report this problem to https://github.com/lampepfl/dotty/.\n" +
286+
s"${tpe.show(using Printer.TypeReprStructure)}"
287+
throw MatchError(msg)
288+
275289
private def typeBound(using Quotes)(t: reflect.TypeRepr, low: Boolean) =
276290
import reflect._
277291
val ignore = if (low) t.typeSymbol == defn.NothingClass else t.typeSymbol == defn.AnyClass

0 commit comments

Comments
 (0)