Skip to content

Fix Theme.style_from_theme/4 calling undefined Style.from/1#18

Merged
pcharbon70 merged 1 commit into
pcharbon70:mainfrom
johnnymo87:fix-style-from-undefined
Jan 8, 2026
Merged

Fix Theme.style_from_theme/4 calling undefined Style.from/1#18
pcharbon70 merged 1 commit into
pcharbon70:mainfrom
johnnymo87:fix-style-from-undefined

Conversation

@johnnymo87

@johnnymo87 johnnymo87 commented Jan 6, 2026

Copy link
Copy Markdown
Contributor

Note: there a several different reasons why tests are failing on develop. This PR addresses one of them. But the CI build will be red because it doesn't address the others (saved for follow work). I'm also open to instead opening a PR with all the fixes for all the failing tests.

Summary

  • Fix production bug where Theme.style_from_theme/4 crashed with UndefinedFunctionError because it called Style.from/1 which doesn't exist in TermUI.Renderer.Style
  • Add has_attr?/2 to TermUI.Renderer.Style for API parity
  • Update test aliases to match the actual return type (TermUI.Renderer.Style)

Details

theme.ex aliases TermUI.Renderer.Style as Style, but line 428 was calling Style.from(overrides). This function only exists in TermUI.Style, not TermUI.Renderer.Style. Changed to Style.new(overrides) which exists and accepts the same keyword list argument.

Test plan

  • Existing theme tests now pass
  • No new test failures introduced

🤖 Generated with Claude Code

Theme aliases TermUI.Renderer.Style but was calling Style.from/1,
which only exists in TermUI.Style. This caused UndefinedFunctionError
when style_from_theme/4 was invoked.

Changed to Style.new/1 which exists in Renderer.Style and accepts
the same keyword list argument. Also added has_attr?/2 to
Renderer.Style for API parity, and updated test aliases to match
the actual return type.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@johnnymo87 johnnymo87 marked this pull request as ready for review January 6, 2026 17:54
@pcharbon70 pcharbon70 merged commit 319d31b into pcharbon70:main Jan 8, 2026
1 check failed
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