Skip to content

Scaladoc: Handle types that were throwing match errors #12553

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

Merged
merged 1 commit into from
May 27, 2021
Merged
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
14 changes: 14 additions & 0 deletions scaladoc/src/dotty/tools/scaladoc/tasty/TypesSupport.scala
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,20 @@ trait TypesSupport:

case RecursiveType(tp) => inner(tp)

case MatchCase(pattern, rhs) =>
texts("case ") ++ inner(pattern) ++ texts(" => ") ++ inner(rhs)

case t: dotty.tools.dotc.core.Types.LazyRef => try {
inner(t.ref(using ctx.compilerContext).asInstanceOf[TypeRepr])
} catch {
case e: AssertionError => texts("LazyRef(...)")
}

case tpe =>
val msg = s"Encountered unsupported type. Report this problem to https://github.com/lampepfl/dotty/.\n" +
s"${tpe.show(using Printer.TypeReprStructure)}"
throw MatchError(msg)

private def typeBound(using Quotes)(t: reflect.TypeRepr, low: Boolean) =
import reflect._
val ignore = if (low) t.typeSymbol == defn.NothingClass else t.typeSymbol == defn.AnyClass
Expand Down