Skip to content

feat(InterpolationCodeWriter): add non-nullable WriteLine overloads for all primitive types#231

Merged
skarllot merged 1 commit intomainfrom
feat/writeline-overloads
Feb 19, 2026
Merged

feat(InterpolationCodeWriter): add non-nullable WriteLine overloads for all primitive types#231
skarllot merged 1 commit intomainfrom
feat/writeline-overloads

Conversation

@skarllot
Copy link
Copy Markdown
Owner

@skarllot skarllot commented Feb 19, 2026

Summary

  • Add WriteLine non-nullable overloads for bool, char, byte, sbyte, short, ushort, int, uint, long, ulong, float, double, and decimal to match the existing Write non-nullable API
  • Add tests covering all 13 new non-nullable overloads
  • Add tests covering all previously untested nullable WriteLine overloads (char?, byte?, sbyte?, short?, ushort?, uint?, long?, ulong?, float?, double?, decimal? — both value and null cases — plus the missing bool? null case)

Test plan

  • All 92 tests pass on net8.0 and net10.0
  • Each new non-nullable overload has a dedicated test verifying value + newline output
  • Each previously untested nullable overload has tests for both the has-value and null cases

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features
    • Extended WriteLine method with overloads for all primitive data types (booleans, characters, integers, floating-point numbers, decimals) and their nullable variants, enabling more convenient value output.

…or all primitive types

Add WriteLine overloads for bool, char, byte, sbyte, short, ushort, int,
uint, long, ulong, float, double and decimal to match the existing Write
non-nullable API. Cover all new and previously untested nullable WriteLine
overloads with tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 19, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

Added 26 new WriteLine method overloads to SourceTextWriter for various primitive types and their nullable variants. Each overload writes the value and appends a newline. Comprehensive test coverage added for all overloads. Version bumped from 2.0 to 2.1.

Changes

Cohort / File(s) Summary
SourceTextWriter WriteLine Overloads
src/InterpolationCodeWriter/SourceTextWriter.WriteLine.cs
Added 26 new WriteLine overload methods for bool, char, all integral types (byte, sbyte, short, ushort, int, uint, long, ulong), floating-point types (float, double), decimal, string, object, and their nullable variants. Each overload calls Write(...) then appends newline.
WriteLine Test Suite
tests/InterpolationCodeWriter.Tests/SourceTextWriterTest.WriteLine.cs
Added 336 lines of test cases covering all 26 WriteLine overloads, verifying correct value output with newline appending and proper null handling for nullable variants.
Version Update
version.json
Updated version field from "2.0" to "2.1".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

Suggested reviewers

  • fgodoy-lepaho

Poem

🐰 A flutter of WriteLine, so neat and so fine,
Twenty-six types now each have their time,
From bool to decimal, from int to the rest,
Each one gets a line—we've passed the test!
Version two-point-one, our achievement's defined,
More methods, more magic, perfectly aligned!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.85% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding non-nullable WriteLine overloads for primitive types, which aligns with the comprehensive set of 13 new method overloads added to SourceTextWriter.
Description check ✅ Passed The description covers the key aspects: details the 13 new non-nullable overloads, describes tests added for both new and previously untested nullable overloads, includes test results (92 tests pass on net8.0 and net10.0), and confirms local build success with checkmarks.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/writeline-overloads

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@skarllot skarllot merged commit 5116d7d into main Feb 19, 2026
5 checks passed
@skarllot skarllot deleted the feat/writeline-overloads branch February 19, 2026 20:23
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