Show some of inherited members of a structure in `ShowAPI.scala`

Showing inherited members of a structure was disabled so we would not
run into cycles. To best of my knowledge, we can run into cycles only
if inherited member is `ClassLike`. We filter out those and let
anything else to be shown.
This commit is contained in:
Grzegorz Kossakowski 2013-01-22 17:53:38 -08:00 committed by Mark Harrah
parent beb87f2789
commit f101bcd3d0
1 changed files with 5 additions and 3 deletions

View File

@ -210,9 +210,11 @@ trait ShowTypes
{
implicit def showStructure(implicit t: Show[Type], d: Show[Definition]): Show[Structure] =
new Show[Structure] {
def show(s: Structure) =
// don't show inherited to avoid dealing with cycles
concat(s.parents, t, " with ") + "\n{\n" + lines(s.declared, d) + "\n}"
def show(s: Structure) = {
// don't show inherited class like definitions to avoid dealing with cycles
val safeInherited = s.inherited.filterNot(_.isInstanceOf[ClassLike])
concat(s.parents, t, " with ") + "\n{\n" + lines(safeInherited ++ s.declared, d) + "\n}"
}
}
implicit def showAnnotated(implicit as: Show[Annotation], t: Show[Type]): Show[Annotated] =
new Show[Annotated] { def show(a: Annotated) = spaced(a.annotations, as) + " " + t.show(a.baseType) }