Skip to content

Docs/enable snippet compiler on enums reference #19498

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

i10416
Copy link
Contributor

@i10416 i10416 commented Jan 20, 2024

Related to: #12967

@i10416
Copy link
Contributor Author

i10416 commented Jan 20, 2024

Why dotty.tools.dotc.MissingCoreLibraryException: Could not find package scala from compiler core libraries...?

dotty.tools.dotc.MissingCoreLibraryException: Could not find package scala from compiler core libraries.
Make sure the compiler core libraries are on the classpath.
   
	at dotty.tools.dotc.core.Denotations$.select$1(Denotations.scala:1317)
	at dotty.tools.dotc.core.Denotations$.recurSimple$1(Denotations.scala:1345)
	at dotty.tools.dotc.core.Denotations$.recur$1(Denotations.scala:1347)
	at dotty.tools.dotc.core.Denotations$.staticRef(Denotations.scala:1351)
	at dotty.tools.dotc.core.Symbols$.requiredPackage(Symbols.scala:917)
	at dotty.tools.dotc.core.Definitions.ScalaPackageVal(Definitions.scala:215)
	at dotty.tools.dotc.core.Definitions.ScalaPackageClass(Definitions.scala:218)
	at dotty.tools.dotc.core.Definitions.AnyClass(Definitions.scala:280)
	at dotty.tools.dotc.core.Definitions.syntheticScalaClasses(Definitions.scala:2130)
	at dotty.tools.dotc.core.Definitions.syntheticCoreClasses(Definitions.scala:2144)
	at dotty.tools.dotc.core.Definitions.init(Definitions.scala:2160)
	at dotty.tools.dotc.core.Contexts$ContextBase.initialize(Contexts.scala:900)
	at dotty.tools.dotc.core.Contexts$Context.initialize(Contexts.scala:523)
	at dotty.tools.scaladoc.snippets.SnippetCompiler$SnippetDriver$.<init>(SnippetCompiler.scala:43)
	at dotty.tools.scaladoc.snippets.SnippetCompiler.SnippetDriver$lzyINIT1(SnippetCompiler.scala:27)
	at dotty.tools.scaladoc.snippets.SnippetCompiler.SnippetDriver(SnippetCompiler.scala:27)
	at dotty.tools.scaladoc.snippets.SnippetCompiler.compile(SnippetCompiler.scala:[102](https://github.com/lampepfl/dotty/actions/runs/7595561396/job/20688267242?pr=19498#step:9:103))
	at dotty.tools.scaladoc.snippets.SnippetChecker.checkSnippet(SnippetChecker.scala:54)
	at dotty.tools.scaladoc.site.TemplateFile.snippetCheckingFunc$lzyINIT1$1$$anonfun$1(templates.scala:90)
	at dotty.tools.scaladoc.site.TemplateFile.snippetCheckingFunc$lzyINIT1$1$$anonfun$adapted$1(templates.scala:96)
	at dotty.tools.scaladoc.snippets.FlexmarkSnippetProcessor$.processSnippets$$anonfun$1(FlexmarkSnippetProcessor.scala:69)
	at scala.collection.LinearSeqOps.foldLeft(LinearSeq.scala:183)
	at scala.collection.LinearSeqOps.foldLeft$(LinearSeq.scala:179)
	at scala.collection.immutable.List.foldLeft(List.scala:79)
	at dotty.tools.scaladoc.snippets.FlexmarkSnippetProcessor$.processSnippets(FlexmarkSnippetProcessor.scala:87)
	at dotty.tools.scaladoc.site.TemplateFile.$anonfun$6(templates.scala:[124](https://github.com/lampepfl/dotty/actions/runs/7595561396/job/20688267242?pr=19498#step:9:125))
	at scala.util.ChainingOps$.pipe$extension(ChainingOps.scala:64)
	at dotty.tools.scaladoc.site.TemplateFile.resolveInner(templates.scala:124)
	at dotty.tools.scaladoc.site.LoadedTemplate.resolveToHtml(LoadedTemplate.scala:54)
	at dotty.tools.scaladoc.renderers.ResolvedTemplate.<init>(SiteRenderer.scala:18)
	at dotty.tools.scaladoc.renderers.ResolvedTemplate$.apply(SiteRenderer.scala:17)
	at dotty.tools.scaladoc.renderers.SiteRenderer.templateToPage(SiteRenderer.scala:25)
	at dotty.tools.scaladoc.renderers.SiteRenderer.templateToPage$(SiteRenderer.scala:21)
	at dotty.tools.scaladoc.renderers.Renderer.templateToPage(Renderer.scala:20)
	at dotty.tools.scaladoc.renderers.SiteRenderer.templateToPage$$anonfun$1(SiteRenderer.scala:26)
	at scala.collection.immutable.List.map(List.scala:246)
	at dotty.tools.scaladoc.renderers.SiteRenderer.templateToPage(SiteRenderer.scala:26)
	at dotty.tools.scaladoc.renderers.SiteRenderer.templateToPage$(SiteRenderer.scala:21)
	at dotty.tools.scaladoc.renderers.Renderer.templateToPage(Renderer.scala:20)
	at dotty.tools.scaladoc.renderers.SiteRenderer.templateToPage$$anonfun$1(SiteRenderer.scala:26)
	at scala.collection.immutable.List.map(List.scala:250)
	at dotty.tools.scaladoc.renderers.SiteRenderer.templateToPage(SiteRenderer.scala:26)
	at dotty.tools.scaladoc.renderers.SiteRenderer.templateToPage$(SiteRenderer.scala:21)
	at dotty.tools.scaladoc.renderers.Renderer.templateToPage(Renderer.scala:20)
	at dotty.tools.scaladoc.renderers.Renderer.$anonfun$5(Renderer.scala:92)
	at scala.collection.immutable.List.map(List.scala:246)
	at dotty.tools.scaladoc.renderers.Renderer.<init>(Renderer.scala:92)
	at dotty.tools.scaladoc.renderers.HtmlRenderer.<init>(HtmlRenderer.scala:10)
	at dotty.tools.scaladoc.Scaladoc$.run(Scaladoc.scala:241)
	at dotty.tools.scaladoc.Scaladoc$.run$$anonfun$1(Scaladoc.scala:70)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.Option.map(Option.scala:242)
	at dotty.tools.scaladoc.Scaladoc$.run(Scaladoc.scala:74)
	at dotty.tools.scaladoc.Main.run(Main.scala:8)
	at dotty.tools.scaladoc.Main$.main(Main.scala:14)

@i10416
Copy link
Contributor Author

i10416 commented Jan 22, 2024

I decided to skip docs directory for now.

792221d

This commit adds workaround for the MissingCoreLibraryException due to
`sc:fail` and enables snippet compiler on enums reference documents.

See scala#19513 (comment)
@i10416 i10416 changed the title Docs/enable sc on enums reference Docs/enable snippet compiler on enums reference Jan 27, 2024
@nicolasstucki nicolasstucki requested a review from sjrd February 1, 2024 08:28
@@ -2362,8 +2362,7 @@ object ScaladocConfigs {
s"$dottyLibRoot/src/scala=compile",
s"$dottyLibRoot/src/scala/compiletime=compile",
s"$dottyLibRoot/src/scala/util=compile",
s"$dottyLibRoot/src/scala/util/control=compile",
"docs/_docs/reference/enums=compile"
s"$dottyLibRoot/src/scala/util/control=compile"
Copy link
Member

Choose a reason for hiding this comment

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

Huh, I'm confused. Is this an inclusion list or an exclusion list?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for feedback. I think it is an inclusion list and I did something weird 🤔 I'll fix it.

Copy link
Contributor Author

@i10416 i10416 Feb 9, 2024

Choose a reason for hiding this comment

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

Hmm, I have no idea why the previous contributor added files to stableScala3 instead of Scala3 task. I think it is enough to add them to Scala3 task as stableScala3 uses Scala3 value anyway. All the Scala code blocks in doc-comments and doc markdown files are type-checked.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If there was something specific to stableScala3 task, it should have been added to stableScala3, but I don't think there is with regard to files to apply the snippet compiler.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure this change f3cb10b is necessary, but in case dottyLibRoot/src is somehow different from scalaLibrarySrc, files under dottyLibrarySrc are also included to snippet compiler.

@sjrd sjrd assigned i10416 and unassigned sjrd Feb 5, 2024
@i10416 i10416 force-pushed the docs/enable-sc-on-enums-reference branch from c310b7b to 9f4fa00 Compare February 9, 2024 19:18
@i10416 i10416 force-pushed the docs/enable-sc-on-enums-reference branch from 9f4fa00 to 690de4c Compare February 9, 2024 19:41
In case `dottyLibRoot/src` is different from `scalaLibrarySrc`,
files under `dottyLibrarySrc` are included to snippet compiler.
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.

2 participants