Skip to content

Commit e940421

Browse files
committed
Added some corrections
- Correct typo in SignatureTest file - Correct from the feedback
1 parent 1828c8a commit e940421

File tree

3 files changed

+8
-20
lines changed

3 files changed

+8
-20
lines changed

project/Build.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ object Build {
361361
// Settings used when compiling dotty with a non-bootstrapped dotty
362362
lazy val commonBootstrappedSettings = commonDottySettings ++ NoBloopExport.settings ++ Seq(
363363
// To enable support of scaladoc and language-server projects you need to change this to true and use sbt as your build server
364-
// bspEnabled := false,
364+
bspEnabled := false,
365365
(Compile / unmanagedSourceDirectories) += baseDirectory.value / "src-bootstrapped",
366366

367367
version := dottyVersion,

scaladoc-testcases/src/tests/extensionParams.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ extension (using Unit)(a: Int)
6161
def f14(): Any
6262
= ???
6363

64-
extension (a: Int)(using Unit)
65-
def f15(): Any
66-
= ???
67-
6864
import scala.language.experimental.clauseInterleaving
6965

7066
extension (using String)(using Int)(a: Animal)(using Unit)(using Number)

scaladoc/test/dotty/tools/scaladoc/signatures/SignatureTest.scala

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ abstract class SignatureTest(
4343

4444
val unexpected = unexpectedFromSources.flatMap(actualSignatures.get).flatten
4545
val expectedButNotFound = expectedFromSources.flatMap {
46-
case (k, v) => findMissingSingatures(v, actualSignatures.getOrElse(k, Nil))
46+
case (k, v) => findMissingSignatures(v, actualSignatures.getOrElse(k, Nil))
4747
}
4848

4949
val missingReport = Option.when(!ignoreMissingSignatures && !expectedButNotFound.isEmpty)
@@ -75,26 +75,21 @@ abstract class SignatureTest(
7575
private val unexpectedRegex = raw"(.+)//unexpected".r
7676
private val identifierRegex = raw"^\s*(`.*`|(?:\w+)(?:_[^\[\(\s]+)|\w+|[^\[\(\s]+)".r
7777

78-
private def findMissingSingatures(expected: Seq[String], actual: Seq[String]): Set[String] =
78+
private def findMissingSignatures(expected: Seq[String], actual: Seq[String]): Set[String] =
7979
expected.toSet &~ actual.toSet
8080

8181
extension (s: String)
8282
private def startWithAnyOfThese(c: String*) = c.exists(s.startsWith)
8383
private def compactWhitespaces = whitespaceRegex.replaceAllIn(s, " ")
8484

85-
private var counter = 0
8685
private def findName(signature: String, kinds: Seq[String]): Option[String] =
8786
for
8887
kindMatch <- kinds.flatMap(k =>s"\\b$k\\b".r.findFirstMatchIn(signature)).headOption
88+
kind <- Option(kindMatch.group(0)) // to filter out nulls
8989
afterKind <- Option(kindMatch.after(0)) // to filter out nulls
90-
nameMatch <- identifierRegex.findFirstMatchIn(
91-
if kindMatch.group(0).contains("extension")
92-
then
93-
signature
94-
else
95-
afterKind
96-
)
97-
yield nameMatch.group(1)
90+
name <- if kind.contains("extension") then Some(signature) // The name of an extension will always be the signature itself
91+
else identifierRegex.findFirstMatchIn(afterKind).map(_.group(1))
92+
yield name
9893

9994
private def signaturesFromSources(source: Source, kinds: Seq[String]): Seq[SignatureRes] =
10095
source.getLines.map(_.trim)
@@ -118,9 +113,7 @@ abstract class SignatureTest(
118113
def processFile(path: Path): Unit = if filterFunc(path) then
119114
val document = Jsoup.parse(IO.read(path))
120115
val documentable = document.select(".groupHeader").forEach { element =>
121-
val signature = element.select(".groupHeader").eachText.asScala.mkString("")
122-
val all = s"$signature"
123-
signatures += all
116+
signatures += element.text
124117
}
125118
val content = document.select(".documentableElement").forEach { elem =>
126119
val annotations = elem.select(".annotations").eachText.asScala.mkString("")
@@ -134,7 +127,6 @@ abstract class SignatureTest(
134127
val all = s"$annotations$other $sigPrefix$signature".trim()
135128
signatures += all
136129
}
137-
counter = 0
138130

139131
IO.foreachFileIn(output, processFile)
140132
signatures.result

0 commit comments

Comments
 (0)