fix(markdown): restore constructor application - #52
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a Scala 3 name-resolution regression in the markdown module where a private top-level term named Markdown accidentally shadowed the public Markdown class for external callers, breaking source-compatible constructor application (Markdown(...)) outside scalatui.markdown.
Changes:
- Renamed the private render-cache holder object to avoid shadowing the public
Markdownclass, and updated the cache entry type usages accordingly. - Added a regression test in an external package (
scalatui.markdown.consumer) to ensureMarkdown(...)constructor application works for non-scalatui.markdowncallers. - Documented the regression fix under
Unreleasedin the changelog.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
markdown/src/scalatui/markdown/MarkdownRenderer.scala |
Renames the private cache object and updates the cached entry type to restore external Markdown(...) constructor application. |
markdown/test/src/scalatui/markdown/consumer/MarkdownPublicApiSuite.scala |
Adds an external-package regression test that exercises Markdown(...) and validates the constructed component’s text. |
CHANGELOG.md |
Notes the fix under Unreleased for visibility in the next patch release. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
Markdown(...)constructor application for callersoutside
scalatui.markdownMarkdownclass in external source0.7.0regression underUnreleasedRoot Cause
The Markdown render cache introduced a private top-level object named
Markdown. Code insidescalatui.markdowncould still use the class's Scala 3constructor application, but external callers resolved the inaccessible private
term instead, making the previously supported
Markdown(...)syntax fail tocompile. Explicit
new Markdown(...)remained available.User Impact
This restores the constructor syntax used by the published Scala CLI Markdown
example and by source that compiled against
0.6.0. After merge, the fix shouldbe published as a
0.7.1patch release.Validation
mill --no-server markdown.test markdownNative.testmill --no-server __.compilemill --no-server scalafmtCheckmill --no-server scalafixCheckopenspec validate --all --strict(13 passed, 0 failed)git diff --check