Skip to content

Commit 73adbcc

Browse files
committed
Tastydoc: update collection usage
1 parent 0473b15 commit 73adbcc

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

tastydoc/src/dotty/tastydoc/TastyExtractor.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ trait TastyExtractor extends TastyTypeConverter with CommentParser with CommentC
1111
import reflect.{given, _}
1212

1313
val pathArray = symbol.show.split("\\.") // NOTE: this should print w/o colors, inspect afterwards
14-
pathArray.view(0, pathArray.length - 1).toList
14+
pathArray.iterator.slice(0, pathArray.length - 1).toList
1515
}
1616

1717
def extractModifiers(reflect: Reflection)(flags: reflect.Flags, privateWithin: Option[reflect.Type], protectedWithin: Option[reflect.Type]) : (List[String], Option[Reference], Option[Reference]) = {

tastydoc/src/dotty/tastydoc/comment/BodyEntities.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package dotty.tastydoc
22
package comment
33

4-
import scala.collection._
4+
import scala.collection.{Seq => _, _}
55
import representations._
66

77
/** A body of text. A comment has a single body, which is composed of

tastydoc/src/dotty/tastydoc/comment/Comment.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ trait MarkupConversion[T](packages: Map[String, EmulatedPackageRepresentation])
8181
see = filterEmpty(parsed.see).map(markupToMarkdown),
8282
result = single("@result", parsed.result).map(markupToMarkdown),
8383
throws = linkedExceptions(parsed.throws),
84-
valueParams = filterEmpty(parsed.valueParams).mapValues(markupToMarkdown),
85-
typeParams = filterEmpty(parsed.typeParams).mapValues(markupToMarkdown),
84+
valueParams = filterEmpty(parsed.valueParams).mapValues(markupToMarkdown).toMap,
85+
typeParams = filterEmpty(parsed.typeParams).mapValues(markupToMarkdown).toMap,
8686
version = single("@version", parsed.version).map(markupToMarkdown),
8787
since = single("@since", parsed.since).map(markupToMarkdown),
8888
todo = filterEmpty(parsed.todo).map(markupToMarkdown),
@@ -91,9 +91,9 @@ trait MarkupConversion[T](packages: Map[String, EmulatedPackageRepresentation])
9191
example = filterEmpty(parsed.example).map(markupToMarkdown),
9292
constructor = single("@constructor", parsed.constructor).map(markupToMarkdown),
9393
group = single("@group", parsed.group).map(markupToMarkdown),
94-
groupDesc = filterEmpty(parsed.groupDesc).mapValues(markupToMarkdown),
95-
groupNames = filterEmpty(parsed.groupNames).mapValues(markupToMarkdown),
96-
groupPrio = filterEmpty(parsed.groupPrio).mapValues(markupToMarkdown),
94+
groupDesc = filterEmpty(parsed.groupDesc).mapValues(markupToMarkdown).toMap,
95+
groupNames = filterEmpty(parsed.groupNames).mapValues(markupToMarkdown).toMap,
96+
groupPrio = filterEmpty(parsed.groupPrio).mapValues(markupToMarkdown).toMap,
9797
hideImplicitConversions = filterEmpty(parsed.hideImplicitConversions).map(markupToMarkdown)
9898
)
9999
}
@@ -124,16 +124,16 @@ extends MarkupConversion[MarkdownNode](packages) {
124124
.map(stringToMarkup)
125125

126126
def filterEmpty(xs: Map[String, String]) =
127-
xs.mapValues(_.trim)
127+
xs.mapValues(_.trim).toMap
128128
.filterNot { case (_, v) => v.isEmpty }
129-
.mapValues(stringToMarkup)
129+
.mapValues(stringToMarkup).toMap
130130
}
131131

132132
case class WikiComment(ent: Representation, parsed: ParsedComment, packages: Map[String, EmulatedPackageRepresentation])
133133
extends MarkupConversion[Body](packages) {
134134

135135
def filterEmpty(xs: Map[String,String]) =
136-
xs.mapValues(_.toWiki(ent, packages))
136+
xs.mapValues(_.toWiki(ent, packages)).toMap
137137
.filterNot { case (_, v) => v.blocks.isEmpty }
138138

139139
def filterEmpty(xs: List[String]) =
@@ -151,7 +151,7 @@ extends MarkupConversion[Body](packages) {
151151
}
152152

153153
def linkedExceptions(m: Map[String, String]) = {
154-
m.mapValues(_.toWiki(ent, packages)).map { case (targetStr, body) =>
154+
m.mapValues(_.toWiki(ent, packages)).toMap.map { case (targetStr, body) =>
155155
val link = lookup(Some(ent), packages, targetStr)
156156
val newBody = body match {
157157
case Body(List(Paragraph(Chain(content)))) =>

tastydoc/src/dotty/tastydoc/comment/WikiParser.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ private[comment] final class WikiParser(
9090
line = listLine(indent, style)
9191
}
9292
val constructor = listStyles(style)
93-
constructor(lines)
93+
constructor(lines.toList)
9494
}
9595

9696
val indent = countWhitespace

0 commit comments

Comments
 (0)