Skip to content

Use the new stdlib when generating scaladoc #23744

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 14, 2025

Conversation

hamzaremmal
Copy link
Member

In this PR, we use the new stdlib project to generate the scaladoc and website of scala 3.
The previous build used scala2-library-bootstrapped to fetch have tasty files available. We change this by now using the real, and to be, TASTy files for the stdlib.
This changes will already take effect in the first run after the merge of this PR.

Comment on lines +3820 to +3821
//s"${dottyLibRoot}=markdown",
//s"${stdLibRoot}=wiki",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, we cannot have both syntax available in the same sources... for now we just kept the default one until we find a better solution.

Comment on lines +3826 to +3831
//.add(SnippetCompiler(List(
//s"$dottyLibRoot/src/scala=compile",
//s"$dottyLibRoot/src/scala/compiletime=compile",
//s"$dottyLibRoot/src/scala/util=compile",
//s"$dottyLibRoot/src/scala/util/control=compile"
//)))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We disable the snippet compiler for now too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When can we turn it back on?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we determine the set of packages we need to enable it for.

Comment on lines -270 to -294
/** Extracts members while taking Dotty logic for patching the stdlib into account. */
def extractPatchedMembers: Seq[Member] = {
val ownMembers = c.extractMembers
def extractPatchMembers(sym: Symbol) = {
// NOTE for some reason scala.language$.experimental$ class doesn't show up here, so we manually add the name
val ownMemberDRIs = ownMembers.iterator.map(_.name).toSet + "experimental$"
sym.tree.asInstanceOf[ClassDef]
.membersToDocument.filterNot(m => ownMemberDRIs.contains(m.symbol.name))
.flatMap(parseMember(c))
}
c.symbol.fullName match {
case "scala.Predef$" =>
ownMembers ++
extractPatchMembers(qctx.reflect.Symbol.requiredClass("scala.runtime.stdLibPatches.Predef$"))
case "scala.language$" =>
ownMembers ++
extractPatchMembers(qctx.reflect.Symbol.requiredModule("scala.runtime.stdLibPatches.language").moduleClass)
case "scala.language$.experimental$" =>
ownMembers ++
extractPatchMembers(qctx.reflect.Symbol.requiredModule("scala.runtime.stdLibPatches.language.experimental").moduleClass)
case _ => ownMembers
}

}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new stdlib doesn't patch anymore, we can remove the logic here.

Copy link
Contributor

@natsukagami natsukagami left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of sbt magic that I'm not sure I fully get, but looks ok to me

Comment on lines +3826 to +3831
//.add(SnippetCompiler(List(
//s"$dottyLibRoot/src/scala=compile",
//s"$dottyLibRoot/src/scala/compiletime=compile",
//s"$dottyLibRoot/src/scala/util=compile",
//s"$dottyLibRoot/src/scala/util/control=compile"
//)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When can we turn it back on?

@hamzaremmal hamzaremmal enabled auto-merge August 14, 2025 18:25
@@ -3798,13 +3782,8 @@ object ScaladocConfigs {
)
}

lazy val DefaultGenerationConfig = Def.task {
def distLocation = (dist / Universal / stage).value
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build failed because this had the side effect of being executed (which is obviously an sbt bug and why I removed it) but the CI workflow relies on this buggy effect.
I'm updating the CI workflow file to publish the commands locally before testing.

@hamzaremmal hamzaremmal merged commit 0cf7a18 into scala:main Aug 14, 2025
45 checks passed
@hamzaremmal hamzaremmal deleted the scaladoc-new-stdlib branch August 14, 2025 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants