Skip to content

[repo-assist] feat: declare IParsable(T), ISpanParsable(T), and IMinMaxValue(T)#187

Merged
NichUK merged 1 commit into
developfrom
repo-assist/improve-interfaces-2026-06-17-9cbb0f9555146672
Jun 17, 2026
Merged

[repo-assist] feat: declare IParsable(T), ISpanParsable(T), and IMinMaxValue(T)#187
NichUK merged 1 commit into
developfrom
repo-assist/improve-interfaces-2026-06-17-9cbb0f9555146672

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

🤖 This is an automated pull request from Repo Assist.

Summary

FixedPointNano already had Parse/TryParse methods and MaxValue/MinValue properties, but had not formally declared the corresponding generic-math interfaces. This PR wires up three lightweight interface declarations so consumers can use them with generic constraints.

Changes

src/FixedPointNano/FixedPointNano.cs — three interfaces added to the struct declaration:

Interface Members already present
IParsable<FixedPointNano> Parse(string, IFormatProvider?), TryParse(string?, IFormatProvider?, out T)
ISpanParsable<FixedPointNano> Parse(ReadOnlySpan<char>, IFormatProvider?), TryParse(ReadOnlySpan<char>, IFormatProvider?, out T)
IMinMaxValue<FixedPointNano> MaxValue, MinValue

No method bodies were added or changed — only the struct : ... interface list.

tests/FixedPointNano.Tests/FixedPointNanoTests.cs — 11 new test methods covering:

  • ParseShouldRoundtripFormattedValues
  • ParseSpanShouldRoundtripFormattedValues
  • ParseShouldThrowOnInvalidInput
  • TryParseShouldReturnTrueForValidInput
  • TryParseShouldReturnFalseForInvalidInput
  • TryParseSpanShouldWorkCorrectly
  • TryParseConvenienceOverloadsShouldWork
  • ParseShouldUseFormatProviderForCultureSpecificInput
  • IParsableInterfaceShouldWork (via generic constraint where T : IParsable<T>)
  • ISpanParsableInterfaceShouldWork (via generic constraint where T : ISpanParsable<T>)
  • IMinMaxValueInterfaceShouldExposeCorrectBounds (via generic constraint where T : IMinMaxValue<T>)

Rationale

Declaring these interfaces enables:

  • Generic algorithms that accept IParsable<T> or ISpanParsable<T> to work with FixedPointNano without a cast
  • IMinMaxValue<T> allows generic range-checking utilities to use FixedPointNano directly

These are the natural next step after IParsable/ISpanParsable were discussed in memory as the pending follow-up.

Test Status

dotnet test tests/FixedPointNano.Tests/FixedPointNano.Tests.csproj -c Release
Passed! - Failed: 0, Passed: 1437, Skipped: 0, Total: 1437

All 1437 tests pass (11 new tests added, 0 regressions).

Generated by 🌈 Repo Assist, see workflow run. Learn more.

Add this agentic workflows to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@e15e57b40918dbca11b350c55d02ab61934afa75

…erfaces

FixedPointNano already had Parse/TryParse methods and MaxValue/MinValue
properties. This commit formally declares the three interfaces on the
struct so consumers can use generic constraints against them.

Also adds 11 tests covering Parse, TryParse, and the new interface
contracts via generic helper methods.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@NichUK NichUK marked this pull request as ready for review June 17, 2026 14:00
Copilot AI review requested due to automatic review settings June 17, 2026 14:00
@NichUK NichUK merged commit eb0e9d4 into develop Jun 17, 2026
9 checks passed
@NichUK NichUK deleted the repo-assist/improve-interfaces-2026-06-17-9cbb0f9555146672 branch June 17, 2026 14:01

Copilot AI left a comment

Copy link
Copy Markdown

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 formally declares IParsable<FixedPointNano>, ISpanParsable<FixedPointNano>, and IMinMaxValue<FixedPointNano> on the FixedPointNano struct so consumers can use generic constraints for parsing and bounds in generic-math scenarios. The underlying members already existed; this change makes the type “discoverable” to generic code and adds targeted tests to prevent regressions.

Changes:

  • Added IParsable<T>, ISpanParsable<T>, and IMinMaxValue<T> to FixedPointNano’s implemented interface list (no method body changes).
  • Added parsing and interface-constraint tests covering string/span parse, invalid inputs, convenience overloads, culture-specific parsing, and MinValue/MaxValue exposure.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/FixedPointNano/FixedPointNano.cs Declares IParsable<T>, ISpanParsable<T>, and IMinMaxValue<T> on the struct to enable generic constraints.
tests/FixedPointNano.Tests/FixedPointNanoTests.cs Adds tests validating parsing behavior and that the new interfaces work via generic constraints.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants