Skip to content

ensure to format with invariant culture - #83

Open
koenbeuk wants to merge 1 commit into
mainfrom
fix/culture-invariant-constants
Open

ensure to format with invariant culture#83
koenbeuk wants to merge 1 commit into
mainfrom
fix/culture-invariant-constants

Conversation

@koenbeuk

@koenbeuk koenbeuk commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings August 1, 2026 23:54

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 updates the source generator’s constant-literal emission to use invariant culture formatting, ensuring generated C# code is stable and culture-independent (important for consistent builds and snapshot outputs across different locales).

Changes:

  • Formats integral literals (long, ulong, uint, int, and casted smaller integrals) using CultureInfo.InvariantCulture instead of culture-sensitive interpolation/ToString().
  • Adds an IFormattable fallback to format any other formattable constant values with invariant culture.
  • Keeps existing round-trip formatting for float/double and invariant formatting for decimal.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov

codecov Bot commented Aug 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 11.11111% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...veSharp.Generator/Emitter/ExpressionTreeEmitter.cs 11.11% 8 Missing ⚠️

📢 Thoughts on this report? Let us know!

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