Skip to content

fix(markdown): restore constructor application - #52

Merged
zikolach merged 1 commit into
mainfrom
codex/fix-markdown-constructor-application
Jul 22, 2026
Merged

fix(markdown): restore constructor application#52
zikolach merged 1 commit into
mainfrom
codex/fix-markdown-constructor-application

Conversation

@zikolach

Copy link
Copy Markdown
Owner

Summary

  • restore source-compatible Markdown(...) constructor application for callers
    outside scalatui.markdown
  • rename the private render-cache holder so it no longer shadows the public
    Markdown class in external source
  • add an external-package regression test shared by JVM and Scala Native
  • document the 0.7.0 regression under Unreleased

Root Cause

The Markdown render cache introduced a private top-level object named
Markdown. Code inside scalatui.markdown could still use the class's Scala 3
constructor application, but external callers resolved the inaccessible private
term instead, making the previously supported Markdown(...) syntax fail to
compile. 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 should
be published as a 0.7.1 patch release.

Validation

  • mill --no-server markdown.test markdownNative.test
  • mill --no-server __.compile
  • mill --no-server scalafmtCheck
  • mill --no-server scalafixCheck
  • openspec validate --all --strict (13 passed, 0 failed)
  • git diff --check

@zikolach
zikolach marked this pull request as ready for review July 22, 2026 11:23
@zikolach
zikolach requested a review from Copilot July 22, 2026 11:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 Markdown class, and updated the cache entry type usages accordingly.
  • Added a regression test in an external package (scalatui.markdown.consumer) to ensure Markdown(...) constructor application works for non-scalatui.markdown callers.
  • Documented the regression fix under Unreleased in 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.

@zikolach
zikolach merged commit 953b52a into main Jul 22, 2026
3 checks passed
@zikolach
zikolach deleted the codex/fix-markdown-constructor-application branch July 22, 2026 11:32
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