Skip to content

MIgrate away from Kotlin Documentable #10660

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 12 commits into from
Dec 11, 2020

Conversation

romanowski
Copy link
Contributor

@romanowski romanowski commented Dec 4, 2020

Scala3doc was only loosly using dokka model and it has started to blocking us.

This PR standarize over Member and expand semantic of Kind. This allow us to have more typesafe way to reason about code.

It will also make migration away from dokka easier if needed.

This PR contains #10702 that allow to link to external APIs as well as refactor linking.

Beside that this PR document correctly all members as well as allows to link to given ones.

Signature are rendered correctly (no problem with annotations etc.)

Copy link
Contributor

@abgruszecki abgruszecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a whole bunch of changes in code areas I'm not familiar with. I don't see anything obviously wrong there, but I don't have the time to try and understand them now, someone else should review this as well.

@@ -28,6 +28,12 @@ type JMap[K, V] = java.util.Map[K, V]
type JHashMap[K, V] = java.util.HashMap[K, V]
type JMapEntry[K, V] = java.util.Map.Entry[K, V]

private val emptyListInst = JList()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we preemptively use Collections.emptyList here? I'd prefer to avoid issues due to some code modifying our "empty" list.

private val emptyListInst = JList()
def JNil[A] = emptyListInst.asInstanceOf[JList[A]]

private val emptyMapInst = JMap()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

Copy link
Contributor

@BarkingBad BarkingBad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some indentations mistakes in ClassLikeSupport. Otherwise, looks Ok to me

)

case class TypeParameter(
variance: "" | "+" | "-",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we decide to keep variance explicitly, when bounds are aggregated into Signature?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variance goes before name and in some cases we would like to refer only to name without variance


val ext = c.get(ClasslikeExtension)
override def pageForClasslike(c: DClasslike): ClasslikePageNode = ???
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should add more explanatory message why calling this method fails than "Not Implemented"

else Kind.Class(Nil, Nil)

private def kindForClasslike(classDef: ClassDef): Kind =
def typeArgs = classDef.getTypeParams.map(mkTypeArgument)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too deep indentation?

symbol: Symbol,
member: MemberExtension,
compositeExt: CompositeMemberExtension = CompositeMemberExtension.empty): Member =
new DClass(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we will discuss whether dokka will still remain as a base for our doctool, but if dokka stays, we should consider making Member a subtype od Documentable, and get rid of these hacks with DClass wrapper :P

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually using DClass is really conviniet :)

@romanowski romanowski force-pushed the scala3doc/member-migration branch from fbb52ce to a7ba826 Compare December 10, 2020 18:48
@romanowski romanowski marked this pull request as draft December 10, 2020 18:48
@romanowski romanowski force-pushed the scala3doc/member-migration branch 2 times, most recently from 3a4a125 to bb41d4f Compare December 10, 2020 21:23
romanowski and others added 7 commits December 10, 2020 22:50
Scala3doc was only loosly using dokka model and it has started to blocking us.

This PR standarize over Member and expand semantic of Kind. This allow us to have more typesafe way to reason about code.

It will also make migration away from dokka easier if needed.
@romanowski romanowski force-pushed the scala3doc/member-migration branch from bb41d4f to bcaa1a7 Compare December 10, 2020 23:56
@romanowski romanowski marked this pull request as ready for review December 11, 2020 02:41
@@ -46,182 +46,163 @@ class ScalaSignatureProvider(contentConverter: CommentsToContentConverter)(using

private def stylesIfDeprecated(m: Member): Set[Style] =
if m.deprecated.isDefined then styles ++ Set(TextStyle.Strikethrough) else styles



object ScalaSignatureProvider:
def rawSignature(documentable: Documentable, builder: SignatureBuilder): SignatureBuilder =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Member?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will get rid of all Documentable after this PR is merged

@romanowski romanowski merged commit a6e24e4 into scala:master Dec 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants