Skip to content

Add IParsable/ISpanParsable to Rune - #129464

Merged
MihaZupan merged 6 commits into
mainfrom
copilot/add-try-parse-to-rune
Jun 27, 2026
Merged

Add IParsable/ISpanParsable to Rune#129464
MihaZupan merged 6 commits into
mainfrom
copilot/add-try-parse-to-rune

Conversation

CopilotAI commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Closes#60231

Adds the new interfaces, implemented explicitly

…lt result on failure
Co-authored-by: MihaZupan <25307628+MihaZupan@users.noreply.github.com>
CopilotAI requested review from Copilot and removed request for CopilotJune 16, 2026 14:54
CopilotAI changed the title [WIP] Add TryParse method to Rune typeAdd IParsable&lt;Rune&gt; and ISpanParsable&lt;Rune&gt;Jun 16, 2026
CopilotAI requested a review from MihaZupanJune 16, 2026 14:56
Comment threadsrc/libraries/System.Private.CoreLib/src/System/Text/Rune.cs Outdated
CopilotAI review requested due to automatic review settings June 16, 2026 15:00

CopilotAI 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 expands System.Text.Rune’s generic parsing support by making it implement IParsable<Rune> and ISpanParsable<Rune> (explicitly), aligning with the existing explicit IUtf8SpanParsable<Rune> pattern. It updates the System.Runtime ref surface accordingly and adds targeted unit tests for the new parsing behaviors.

Changes:

  • Add IParsable<Rune> / ISpanParsable<Rune> to Rune and implement the four explicit interface members using DecodeFromUtf16 + full-consumption checks.
  • Update System.Runtime ref to include the new interfaces and explicit member declarations on Rune.
  • Add new RuneTests coverage for valid/invalid UTF-16 single-rune inputs for both string and span parsing paths.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

FileDescription
src/libraries/System.Private.CoreLib/src/System/Text/Rune.csAdds explicit IParsable<Rune> / ISpanParsable<Rune> implementations backed by DecodeFromUtf16 and full-input validation.
src/libraries/System.Runtime/ref/System.Runtime.csUpdates the public contract for Rune to include the two new interfaces and explicit members.
src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Text/RuneTests.csAdds theory-based tests for string/span parse and try-parse success and failure cases.

Comment threadsrc/libraries/System.Private.CoreLib/src/System/Text/Rune.cs Outdated
… Decode tests
Co-authored-by: MihaZupan <25307628+MihaZupan@users.noreply.github.com>
CopilotAI changed the title Add IParsable&lt;Rune&gt; and ISpanParsable&lt;Rune&gt;Add IParsable/ISpanParsable to RuneJun 16, 2026
CopilotAI requested a review from MihaZupanJune 16, 2026 15:57
Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
CopilotAI review requested due to automatic review settings June 16, 2026 22:57
@MihaZupanMihaZupan added this to the 11.0.0 milestone Jun 16, 2026

CopilotAI 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

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

Comment threadsrc/libraries/System.Runtime/ref/System.Runtime.cs
Comment threadsrc/libraries/System.Private.CoreLib/src/System/Text/Rune.cs
@MihaZupan
MihaZupan enabled auto-merge (squash) June 17, 2026 12:24
Comment threadsrc/libraries/System.Private.CoreLib/src/System/Text/Rune.cs
@MihaZupan
MihaZupan merged commit 67d84fc into mainJun 27, 2026
144 checks passed
@MihaZupan
MihaZupan deleted the copilot/add-try-parse-to-rune branch June 27, 2026 06:02
eiriktsarpalis pushed a commit that referenced this pull request Jul 15, 2026
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: MihaZupan <25307628+MihaZupan@users.noreply.github.com>
Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Jul 29, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[API Proposal]: Add [Try]Parse to Rune

4 participants

@tannergooding@MihaZupan