Skip to content

Commit 24e89e2

Browse files
abgruszeckiromanowski
authored andcommitted
Scala3doc: fix all warnings
1 parent 47b91b1 commit 24e89e2

File tree

9 files changed

+22
-16
lines changed

9 files changed

+22
-16
lines changed

scala3doc/src/main/scala/dotty/dokka/DottyDokkaPlugin.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ class DottyDokkaPlugin extends DokkaJavaPlugin:
133133

134134
val muteDefaultSourceLinksTransformer = extend(
135135
_.extensionPoint(CoreExtensions.INSTANCE.getPageTransformer)
136-
.fromInstance(identity)
136+
.fromInstance(new PageTransformer {
137+
override def invoke(root: RootPageNode) = root
138+
})
137139
.overrideExtension(dokkaBase.getSourceLinksTransformer)
138140
.name("muteDefaultSourceLinksTransformer")
139141
)

scala3doc/src/main/scala/dotty/dokka/tasty/ScalaDocSupport.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import dotty.dokka.ScalaTagWrapper
1010
import comments.{kt, dkk}
1111

1212
trait ScaladocSupport { self: TastyParser =>
13-
import reflect.{given _, _}
13+
import reflect._
1414

1515
def parseComment(
1616
commentNode: reflect.Comment,

scala3doc/src/main/scala/dotty/dokka/transformers/InheritanceInformationTransformer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ class InheritanceInformationTransformer(val ctx: DokkaContext) extends Documenta
2424
c.parents.map(_._2 -> selfLink)
2525

2626
c.allMembers.flatMap(getSupertypes) ++ selfMapping
27-
case other => List.empty
28-
}
27+
case null => List.empty
28+
}

scala3doc/src/main/scala/dotty/dokka/transformers/ScalaSourceLinksTransformer.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ class ScalaSourceLinksTransformer(
3434

3535
override def invoke(input: DModule, context: DokkaContext): DModule =
3636
input.updateMembers {
37-
case c: Member with WithSources with WithExtraProperties[Member] =>
37+
case c0: (Member & WithSources & WithExtraProperties[_]) =>
38+
val c = c0.asInstanceOf[Member & WithSources & WithExtraProperties[Member]]
3839
c.withNewExtras(c.getExtra plus getSourceLinks(c))
3940
case c => c
4041
}
@@ -57,4 +58,4 @@ class ScalaSourceLinksTransformer(
5758
link.url + s.path.split(link.path)(1) + link.lineSuffix.map(_ + (line + 1)).getOrElse("") //TASTY enumerates lines from 0
5859
)
5960
case other => None
60-
}
61+
}

scala3doc/src/main/scala/dotty/dokka/translators/FilterAttributes.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ object FilterAttributes:
2727
private def keywords(documentable: Documentable): Map[String, String] = documentable match
2828
case v: Member =>
2929
Map("keywords" -> v.modifiers.map(_.name).mkString(","))
30-
case _ =>
30+
case null =>
3131
Map.empty
3232

3333

3434
private def visibity(documentable: Documentable): Map[String, String] = documentable match
3535
case v: Member =>
3636
Map("visibility" -> v.visibility.name)
37-
case _ =>
37+
case null =>
3838
Map.empty
3939

4040

@@ -45,7 +45,7 @@ object FilterAttributes:
4545
case Origin.ImplicitlyAddedBy(name, _) => Map("implicitly" -> s"by $name")
4646
case Origin.ExtensionFrom(name, _) => Map("extension" -> s"from $name")
4747
case _ => Map.empty
48-
case _ =>
48+
case null =>
4949
Map.empty
5050

5151
def defaultValues = Map(

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ class ScalaPageCreator(
319319
}
320320

321321
d match{
322-
case d: (WithSources & WithExtraProperties[Documentable]) if d.get(SourceLinks) != null && !d.get(SourceLinks).links.isEmpty => d.get(SourceLinks).links.foldLeft(withCompanion){
322+
case d: (WithSources & WithExtraProperties[_]) if d.get(SourceLinks) != null && !d.get(SourceLinks).links.isEmpty => d.get(SourceLinks).links.foldLeft(withCompanion){
323323
case (bdr, (sourceSet, link)) => bdr
324324
.cell(sourceSets = Set(sourceSet)){ b => b
325325
.text("Source")
@@ -336,9 +336,11 @@ class ScalaPageCreator(
336336

337337
def contentForScope(s: Documentable & WithScope & WithExtraProperties[_]) =
338338
def groupExtensions(extensions: Seq[Member]): Seq[DocumentableSubGroup] =
339-
extensions.groupBy(_.kind).map { case (Kind.Extension(on), members) =>
340-
val signature = Signature(s"extension (${on.name}: ") join on.signature join Signature(")")
341-
DocumentableSubGroup(signature, members.toSeq)
339+
extensions.groupBy(_.kind).map {
340+
case (Kind.Extension(on), members) =>
341+
val signature = Signature(s"extension (${on.name}: ") join on.signature join Signature(")")
342+
DocumentableSubGroup(signature, members.toSeq)
343+
case other => sys.error(s"unexpected value: $other")
342344
}.toSeq
343345

344346

scala3doc/src/main/scala/dotty/dokka/translators/ScalaSignatureUtils.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ trait SignatureBuilder extends ScalaSignatureUtils {
3737
elemOp: (SignatureBuilder, E) => SignatureBuilder
3838
): SignatureBuilder = elements match {
3939
case Nil => this
40-
case head +: tail =>
40+
case head :: tail =>
4141
tail.foldLeft(elemOp(text(prefix), head))((b, e) => elemOp(b.text(separator), e)).text(suffix)
4242
}
4343

@@ -118,4 +118,4 @@ trait SignatureBuilder extends ScalaSignatureUtils {
118118

119119
trait ScalaSignatureUtils:
120120
extension (tokens: Seq[String]) def toSignatureString(): String =
121-
tokens.filter(_.trim.nonEmpty).mkString(""," "," ")
121+
tokens.filter(_.trim.nonEmpty).mkString(""," "," ")

scala3doc/src/main/scala/dotty/renderers/DotDiagramBuilder.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ object DotDiagramBuilder:
3333
case Kind.Trait => "fill: #1CAACF;"
3434
case Kind.Enum => "fill: #B66722;"
3535
case Kind.EnumCase => "fill: #B66722;"
36+
case other => sys.error(s"unexpected value: $other")
3637

3738

3839
private def getHtmlLabel(vertex: Vertex, renderer: SignatureRenderer): String =

scala3doc/src/test/scala/dotty/dokka/DottyTestRunner.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ abstract class DottyAbstractCoreTest extends AbstractCoreTest:
5656

5757
def listTastyFiles(f: File): Seq[File] =
5858
val (files, dirs) = f.listFiles().partition(_.isFile)
59-
files.filter(_.getName.endsWith(".tasty")) ++ dirs.flatMap(listTastyFiles)
59+
files.toIndexedSeq.filter(_.getName.endsWith(".tasty")) ++ dirs.flatMap(listTastyFiles)
6060

6161
val tastyFiles = tastyDir.split(File.pathSeparatorChar).toList.flatMap(p => listTastyFiles(new File(p))).map(_.toString)
6262

0 commit comments

Comments
 (0)