Skip to content

Commit c0fe9fc

Browse files
committed
Generate docs for dotty library
Fix #17964
1 parent 52c1bf2 commit c0fe9fc

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

library/src/scala/quoted/ToExpr.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,8 @@ object ToExpr {
422422
/** Default implementation of `ToExpr[BigDecimal using the default MathContext]` */
423423
given BigDecimalToExpr: ToExpr[BigDecimal] with {
424424
def apply(x: BigDecimal)(using Quotes): Expr[BigDecimal] =
425-
'{ BigDecimal(${Expr(x.toString)}) }
425+
val bigDecimal: String = "" + x // workaround "method toString in class BigDecimal does not take parameters" in scaladoc
426+
'{ BigDecimal(${Expr(bigDecimal)}) }
426427
}
427428

428429
/** Default implementation of `ToExpr[StringContext]` */

project/Build.scala

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1962,7 +1962,7 @@ object ScaladocConfigs {
19621962
SourceLinks(
19631963
List(
19641964
scalaSrcLink(stdLibVersion, srcManaged(version, "scala") + "="),
1965-
dottySrcLink(refVersion, srcManaged(version, "dotty") + "=", "#library/src"),
1965+
dottySrcLink(refVersion, "library/src=", "#library/src"),
19661966
dottySrcLink(refVersion),
19671967
"docs=github://lampepfl/dotty/main#docs"
19681968
)
@@ -2047,6 +2047,7 @@ object ScaladocConfigs {
20472047
lazy val Scala3 = Def.task {
20482048
val dottyJars: Seq[java.io.File] = Seq(
20492049
(`stdlib-bootstrapped`/Compile/products).value,
2050+
(`scala3-library-bootstrapped`/Compile/products).value,
20502051
(`scala3-interfaces`/Compile/products).value,
20512052
(`tasty-core-bootstrapped`/Compile/products).value,
20522053
).flatten
@@ -2060,7 +2061,7 @@ object ScaladocConfigs {
20602061
val docRootFile = stdLibRoot.resolve("rootdoc.txt")
20612062

20622063
val dottyManagesSources =
2063-
(`stdlib-bootstrapped`/Compile/sourceManaged).value / "dotty-library-src"
2064+
(`scala3-library-bootstrapped`/Compile/sourceDirectory).value
20642065

20652066
val tastyCoreSources = projectRoot.relativize((`tasty-core-bootstrapped`/Compile/scalaSource).value.toPath().normalize())
20662067

@@ -2088,24 +2089,27 @@ object ScaladocConfigs {
20882089
}
20892090

20902091
def stableScala3(version: String) = Def.task {
2092+
val scalaLibrarySrc = s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed"
2093+
val dottyLibrarySrc = "library/src"
20912094
Scala3.value
20922095
.add(defaultSourceLinks(version + "-bin-SNAPSHOT-nonbootstrapped", version).value)
20932096
.add(ProjectVersion(version))
20942097
.add(SnippetCompiler(
20952098
List(
2096-
s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/dotty-library-src/scala/quoted=compile",
2097-
s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/dotty-library-src/scala/compiletime=compile"
2099+
s"$dottyLibrarySrc/scala/quoted=compile",
2100+
s"$dottyLibrarySrc/scala/compiletime=compile"
20982101
)
20992102
))
21002103
.add(CommentSyntax(List(
2101-
s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/dotty-library-src=markdown",
2102-
s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/scala-library-src=wiki",
2104+
s"$dottyLibrarySrc=markdown",
2105+
s"$scalaLibrarySrc=wiki",
21032106
"wiki"
21042107
)))
2105-
.add(DocRootContent(s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/scala-library-src/rootdoc.txt"))
2108+
.add(DocRootContent(s"$scalaLibrarySrc/rootdoc.txt"))
21062109
.withTargets(
21072110
Seq(
21082111
s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/classes",
2112+
s"out/bootstrap/scala3-library-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/classes",
21092113
s"tmp/interfaces/target/classes",
21102114
s"out/bootstrap/tasty-core-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/classes"
21112115
)

0 commit comments

Comments
 (0)