Skip to content

Commit 750b30a

Browse files
committed
Address review feedback
1 parent cdab39f commit 750b30a

File tree

9 files changed

+64
-69
lines changed

9 files changed

+64
-69
lines changed

docs/docs/reference/new-types/polymorphic-function-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ println(e1) // Apply(Apply(Var(wrap),Var(f)),Apply(Var(wrap),Var(a)))
8080
### Relationship With Type Lambdas
8181

8282
Polymorphic function types are not to be confused with
83-
[_type lambdas_](new-types/type-lambdas.md).
83+
[_type lambdas_](type-lambdas.md).
8484
While the former describes the _type_ of a polymorphic _value_,
8585
the latter is an actual function value _at the type level_.
8686

scala3doc/src/dotty/dokka/DottyDokkaPlugin.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,6 @@ class DottyDokkaPlugin extends DokkaJavaPlugin:
187187
.overrideExtension(dokkaBase.getDokkaLocationProvider)
188188
)
189189

190-
extension (ctx: DokkaContext)
191-
def siteContext: Option[StaticSiteContext] = ctx.getConfiguration.asInstanceOf[DocContext].staticSiteContext
192-
def args: Scala3doc.Args = ctx.getConfiguration.asInstanceOf[DocContext].args
193-
194190
// TODO (https://github.com/lampepfl/scala3doc/issues/232): remove once problem is fixed in Dokka
195191
extension [T] (builder: ExtensionBuilder[T])
196192
def ordered(before: Seq[Extension[_, _, _]], after: Seq[Extension[_, _, _]]): ExtensionBuilder[T] =

scala3doc/src/dotty/dokka/compat.scala

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ import org.jetbrains.dokka.model.properties.ExtraProperty
1111
// import java.util.Stream // TODO reproduction uncomment
1212
import java.util.stream.Stream // comment out - wrong error!
1313
import java.util.stream.Collectors
14+
import java.util.Collections
1415
import org.jetbrains.dokka.plugability._
1516
import kotlin.jvm.JvmClassMappingKt.getKotlinClass
17+
import org.jetbrains.dokka.links._
1618

1719
val U: kotlin.Unit = kotlin.Unit.INSTANCE
1820

@@ -26,15 +28,43 @@ type JMap[K, V] = java.util.Map[K, V]
2628
type JHashMap[K, V] = java.util.HashMap[K, V]
2729
type JMapEntry[K, V] = java.util.Map.Entry[K, V]
2830

29-
private val emptyListInst = JList()
31+
private val emptyListInst = Collections.emptyList
3032
def JNil[A] = emptyListInst.asInstanceOf[JList[A]]
3133

32-
private val emptyMapInst = JMap()
34+
private val emptyMapInst = Collections.emptyMap
3335
def emptyJMap[A, B] = emptyMapInst.asInstanceOf[JMap[A, B]]
3436

3537
type DRI = org.jetbrains.dokka.links.DRI
3638
val topLevelDri = org.jetbrains.dokka.links.DRI.Companion.getTopLevel
3739

40+
extension (dri: DRI)
41+
def withNoOrigin = dri._copy(
42+
extra = Option(dri.getExtra).fold(null)(e => raw"\[origin:(.*)\]".r.replaceAllIn(e, ""))
43+
)
44+
45+
def location: String = dri.getPackageName
46+
47+
def anchor: Option[String] = Option(dri.getClassNames).filterNot(_.isEmpty)
48+
49+
def extra: String = dri.getExtra
50+
51+
def target: DriTarget = dri.getTarget
52+
53+
def _copy(
54+
location: String = dri.location,
55+
anchor: Option[String] = dri.anchor,
56+
target: DriTarget = dri.target,
57+
extra: String = dri.extra
58+
) = new DRI(location, anchor.getOrElse(""), null, target, extra)
59+
60+
object DRI:
61+
def apply(
62+
location: String = "",
63+
anchor: Option[String] = None,
64+
target: DriTarget = PointingToDeclaration.INSTANCE,
65+
extra: String = ""
66+
) = new DRI(location, anchor.getOrElse(""), null, target, extra)
67+
3868
type SourceSetWrapper = DokkaConfiguration$DokkaSourceSet
3969
type DokkaSourceSet = DokkaConfiguration.DokkaSourceSet
4070

scala3doc/src/dotty/dokka/location/ScalaPackageListService.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import org.jetbrains.dokka.links._
77
import org.jetbrains.dokka.pages._
88
import org.jetbrains.dokka.plugability._
99
import collection.JavaConverters._
10-
import dotty.dokka.model.api.withNoOrigin
10+
import dotty.dokka.withNoOrigin
1111

1212
object ScalaPackageListService:
1313
val DOKKA_PARAM_PREFIX = "$dokka"

scala3doc/src/dotty/dokka/model/api/api.scala

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import org.jetbrains.dokka.model.doc._
99
import org.jetbrains.dokka.model.properties._
1010
import org.jetbrains.dokka.pages._
1111
import dotty.dokka.tasty.comments.Comment
12-
import org.jetbrains.dokka.links._
1312

1413
enum Visibility(val name: String):
1514
case Unrestricted extends Visibility("")
@@ -182,34 +181,6 @@ extension (members: Seq[Member]) def byInheritance =
182181
extension (module: DModule)
183182
def driMap: Map[DRI, Member] = ModuleExtension.getFrom(module).fold(Map.empty)(_.driMap)
184183

185-
extension (dri: DRI)
186-
def withNoOrigin = dri._copy(
187-
extra = Option(dri.getExtra).fold(null)(e => raw"\[origin:(.*)\]".r.replaceAllIn(e, ""))
188-
)
189-
190-
def location: String = dri.getPackageName
191-
192-
def anchor: Option[String] = Option(dri.getClassNames).filterNot(_.isEmpty)
193-
194-
def extra: String = dri.getExtra
195-
196-
def target: DriTarget = dri.getTarget
197-
198-
def _copy(
199-
location: String = dri.location,
200-
anchor: Option[String] = dri.anchor,
201-
target: DriTarget = dri.target,
202-
extra: String = dri.extra
203-
) = new DRI(location, anchor.getOrElse(""), null, target, extra)
204-
205-
object DRI:
206-
def apply(
207-
location: String = "",
208-
anchor: Option[String] = None,
209-
target: DriTarget = PointingToDeclaration.INSTANCE,
210-
extra: String = ""
211-
) = new DRI(location, anchor.getOrElse(""), null, target, extra)
212-
213184
case class TastyDocumentableSource(val path: String, val lineNumber: Int)
214185

215186
type DocPart = DocTag

scala3doc/src/dotty/dokka/site/StaticSiteContext.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ import org.jetbrains.dokka.plugability.DokkaContext
1717
import org.jetbrains.dokka.pages.Style
1818
import org.jetbrains.dokka.model.DisplaySourceSet
1919
import util.Try
20-
21-
import scala.collection.JavaConverters._
20+
import collection.JavaConverters._
2221

2322
import dotty.dokka.model.api._
2423

@@ -168,7 +167,8 @@ class StaticSiteContext(
168167
}.toOption
169168
pathsDri.getOrElse(memberLinkResolver(link).toList)
170169

171-
def driFor(dest: Path): DRI = DRI(location = s"_.${root.toPath.relativize(dest)}")
170+
def driFor(dest: Path): DRI =
171+
DRI(location = root.toPath.relativize(dest).iterator.asScala.mkString("."))
172172

173173
def relativePath(myTemplate: LoadedTemplate) = root.toPath.relativize(myTemplate.file.toPath)
174174

scala3doc/src/dotty/dokka/site/common.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ import org.jetbrains.dokka.pages._
2323

2424
import scala.collection.JavaConverters._
2525

26-
val docsRootDRI: DRI = DRI(location = "_.index.md")
27-
val docsDRI: DRI = DRI(location = "_.docs/index.md")
26+
val docsRootDRI: DRI = DRI(location = "index.md")
27+
val docsDRI: DRI = DRI(location = "docs.index.md")
2828
val apiPageDRI: DRI = DRI(location = "api", extra = "__api__")
2929

3030
val defaultMarkdownOptions: DataHolder =

scala3doc/src/dotty/dokka/tasty/ClassLikeSupport.scala

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -27,32 +27,32 @@ trait ClassLikeSupport:
2727
else Kind.Class(Nil, Nil)
2828

2929
private def kindForClasslike(classDef: ClassDef): Kind =
30-
def typeArgs = classDef.getTypeParams.map(mkTypeArgument)
31-
32-
def parameterModifier(parameter: Symbol): String =
33-
val fieldSymbol = classDef.symbol.declaredField(parameter.normalizedName)
34-
def isVal = fieldSymbol.flags.is(Flags.ParamAccessor) &&
35-
!classDef.symbol.flags.is(Flags.Case) &&
36-
!fieldSymbol.flags.is(Flags.Private)
37-
38-
if fieldSymbol.flags.is(Flags.Mutable) then "var "
39-
else if isVal then "val "
40-
else ""
41-
42-
def args = if constructorWithoutParamLists(classDef) then Nil else
43-
val constr =
44-
Some(classDef.constructor.symbol)
45-
.filter(s => s.exists && !s.isHiddenByVisibility)
46-
.map( _.tree.asInstanceOf[DefDef])
47-
constr.fold(Nil)(
48-
_.paramss.map(_.map(mkParameter(_, parameterModifier)))
49-
)
30+
def typeArgs = classDef.getTypeParams.map(mkTypeArgument)
31+
32+
def parameterModifier(parameter: Symbol): String =
33+
val fieldSymbol = classDef.symbol.declaredField(parameter.normalizedName)
34+
def isVal = fieldSymbol.flags.is(Flags.ParamAccessor) &&
35+
!classDef.symbol.flags.is(Flags.Case) &&
36+
!fieldSymbol.flags.is(Flags.Private)
37+
38+
if fieldSymbol.flags.is(Flags.Mutable) then "var "
39+
else if isVal then "val "
40+
else ""
41+
42+
def args = if constructorWithoutParamLists(classDef) then Nil else
43+
val constr =
44+
Some(classDef.constructor.symbol)
45+
.filter(s => s.exists && !s.isHiddenByVisibility)
46+
.map( _.tree.asInstanceOf[DefDef])
47+
constr.fold(Nil)(
48+
_.paramss.map(_.map(mkParameter(_, parameterModifier)))
49+
)
5050

51-
if classDef.symbol.flags.is(Flags.Module) then Kind.Object
52-
else if classDef.symbol.flags.is(Flags.Trait) then
53-
Kind.Trait(typeArgs, args)
54-
else if classDef.symbol.flags.is(Flags.Enum) then Kind.Enum
55-
else Kind.Class(typeArgs, args)
51+
if classDef.symbol.flags.is(Flags.Module) then Kind.Object
52+
else if classDef.symbol.flags.is(Flags.Trait) then
53+
Kind.Trait(typeArgs, args)
54+
else if classDef.symbol.flags.is(Flags.Enum) then Kind.Enum
55+
else Kind.Class(typeArgs, args)
5656

5757
def mkClass[T >: DClass](classDef: ClassDef)(
5858
dri: DRI = classDef.symbol.dri,

scala3doc/src/dotty/dokka/translators/ScalaPageCreator.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ class ScalaPageCreator(
5050
JNil
5151
)
5252

53-
override def pageForClasslike(c: DClasslike): ClasslikePageNode = ???
54-
5553
def pageForMember(c: Member): ClasslikePageNode = {
5654
val name =
5755
if c.kind == Kind.Object && c.companion.isDefined then

0 commit comments

Comments
 (0)