You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An issue that complicates generating suitable scaladoc comments for the collections library (as witnessed in #6947) is the current inheritance scheme for scaladoc comments. Take this example:
traitA { /** A */deff:Any }
traitBextendsA { deff:Any=??? }
traitCextendsA { /** C */deff:Any }
traitDextendsBwithCtraitD2extendsBwithC { /** D */deff:Any }
As (correctly) listed by scaladoc, the linear supertypes of D and D2 are: C, B, A, AnyRef, Any.
Quiz: What do the comments for D.f and D2.f show?
Perhaps surprisingly, they both show "A" with definition classes B -> A. The reason is that scaladoc prefers concrete method definitions over abstract ones, such that both comments are taken from B.f which inherits the comment from A.f. This makes it impossible to refine comments independent of implementations in an inheritance pattern with intertwined definition and implementation traits, as used by the collections library. The only way to get a new comment for D.f is through a concrete definition:
traitD3extendsBwithC { /** D */deff:Any=super.f }
This situation could be improved by always following the linearization order for the enclosing template. In the example, C comes before B and A in the linearization of D, therefore D.f inherits the comment from C.f.
An alternative proposal by @adriaanm is to keep the current scheme of preferring cocrete definitions over abstract definitions but treat definitions with a new doc comment as concrete for this purpose.
The text was updated successfully, but these errors were encountered:
@adriaanm said:
My proposal is to use lookup as usual, except to determine concrete/deferred by looking at the doc comment instead of the definitions's RHS. Linearization would act as the tie breaker in case of diamond inheritance.
@szeiger said:
A related issue arises for "@define" tags. For example, adding a scaladoc comment which references "$coll" to GenMapLike does not use GenMapLike's definition of "coll" when the comment is viewed in GenMap ("trait GenMap... extends GenMapLike... with GenIterable...").
An issue that complicates generating suitable scaladoc comments for the collections library (as witnessed in #6947) is the current inheritance scheme for scaladoc comments. Take this example:
As (correctly) listed by scaladoc, the linear supertypes of D and D2 are: C, B, A, AnyRef, Any.
Quiz: What do the comments for D.f and D2.f show?
Perhaps surprisingly, they both show "A" with definition classes B -> A. The reason is that scaladoc prefers concrete method definitions over abstract ones, such that both comments are taken from B.f which inherits the comment from A.f. This makes it impossible to refine comments independent of implementations in an inheritance pattern with intertwined definition and implementation traits, as used by the collections library. The only way to get a new comment for D.f is through a concrete definition:
This situation could be improved by always following the linearization order for the enclosing template. In the example, C comes before B and A in the linearization of D, therefore D.f inherits the comment from C.f.
An alternative proposal by @adriaanm is to keep the current scheme of preferring cocrete definitions over abstract definitions but treat definitions with a new doc comment as concrete for this purpose.
The text was updated successfully, but these errors were encountered: