Fix missing docstrings in the native-image binary - #131
Merged
Conversation
DocstringExtractor read the Scala version from `dotty.tools.dotc.config.Properties.versionNumberString`, which reads `compiler.properties` out of the compiler jar. native-image does not embed that resource, so the version came back empty and the stdlib fetch asked coursier for a versionless coordinate: not found: https://repo1.maven.org/maven2/.../scala3-library_3//scala3-library_3-.pom The fetch failed, the inspector never ran, and no Scala 3 artifact has ever produced a docstring from a released binary. It failed silently until the recent logging work surfaced it. Reproduced against the published 0.1.0-M10 native binary, which returns no docstring for cats.effect.IO where the JVM build returns one. Read the version from the stdlib instead. Since 3.8 the standard library ships as `org.scala-lang:scala-library` at the Scala 3 version, so `scala.util.Properties.versionNumberString` yields 3.8.4 rather than a 2.13.x version, and native-image does embed its `library.properties`. Verified by rebuilding the native image: the binary embeds version.number=3.8.4, docstrings extract, and the TASTy inspector runs there cleanly with no warnings at --debug. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
rochala
force-pushed
the
fix/native-image-docstrings
branch
from
August 22, 2026 22:23
8e618d2 to
63c164b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
No Scala 3 artifact has ever produced a docstring from a released binary, and it failed silently.
DocstringExtractorread the Scala version fromdotty.tools.dotc.config.Properties.versionNumberString, which readscompiler.propertiesout of the compiler jar. native-image does not embed that resource, so the version came back empty and the stdlib fetch asked coursier for a versionless coordinate:The fetch failed, the TASTy inspector never ran, and the old
catch case _: Exceptionswallowed it.Reproduced against the published
0.1.0-M10native binary:The fix
Read the version from the stdlib rather than the compiler:
Two things make this the right source. Since 3.8 the standard library ships as
org.scala-lang:scala-libraryat the Scala 3 version —scala3-library_3:3.8.4is now a thin shim depending onscala-library:3.8.4, and that jar'slibrary.propertiescarriesversion.number=3.8.4. So this yields a Scala 3 version, not the2.13.xit would have on older Scala 3.And unlike
compiler.properties, native-image does embedlibrary.properties. That is verifiable in the shipped M10 binary, which predates this change:Note this requires the 3.8+ stdlib; a drop below 3.8 would silently return a 2.13 version again, so there is a comment at the call site saying so.
Verification
Rebuilt the native image: it embeds
version.number=3.8.4, docstrings extract, and the TASTy inspector runs cleanly with no warnings at--debug.lib.test372/372,cli.test236/236.This surfaced only because the recent
--debugwork (#127) made the failure visible — and specifically because of the fix to catch fatal errors inside the blocking thunk.Note
The regression class here (JVM works, native-image silently differs) is invisible to the current test suite — nothing ever runs the built binary. Tracked separately in #133; not addressed here.
🤖 Generated with Claude Code