Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[main] Source code updates from dotnet/runtime - #7617

#7617
Merged
dotnet-maestro[bot] merged 3 commits into
maindotnet/dotnet:mainfrom
darc-main-9be1d1d2-5f5d-4fad-9187-7bf8bcc56febdotnet/dotnet:darc-main-9be1d1d2-5f5d-4fad-9187-7bf8bcc56febCopy head branch name to clipboard
Jul 10, 2026
Merged

[main] Source code updates from dotnet/runtime#7617
dotnet-maestro[bot] merged 3 commits into
maindotnet/dotnet:mainfrom
darc-main-9be1d1d2-5f5d-4fad-9187-7bf8bcc56febdotnet/dotnet:darc-main-9be1d1d2-5f5d-4fad-9187-7bf8bcc56febCopy head branch name to clipboard

Conversation

@dotnet-maestro

@dotnet-maestro dotnet-maestro Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Note

This is a codeflow update. It may contain both source code changes from
the source repo
as well as dependency updates. Learn more here.

This pull request brings the following source code changes

From https://github.com/dotnet/runtime

Diff the source with this PR branch
darc vmr diff --name-only https://github.com/dotnet/runtime:6c5849144dc8a23aa0760080d6f7784fed60da37..https://github.com/dotnet/dotnet:darc-main-9be1d1d2-5f5d-4fad-9187-7bf8bcc56feb

@dotnet-maestro

dotnet-maestro Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Note

PRs from original repository included in this codeflow update:

💡 You may consult the FAQ for more information or tag @dotnet/prodconsvcs for assistance.

@dotnet-policy-service
dotnet-policy-service Bot requested a review from a team July 9, 2026 02:21
@dotnet-maestro

dotnet-maestro Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

This pull request only contains source updates from https://github.com/dotnet/runtime between commits fdecb6b73237947d1429b5d3de71edea536b5b53 and e302d2a27aef2196c8d710752da8b7726c5fe84d.

@akoeplinger

Copy link
Copy Markdown
Member
 /__w/1/s/src/fsharp/src/Compiler/Checking/NicePrint.fs(401,25): error FS0041: A unique overload for method 'TryParse' could not be determined based on type information prior to this program point. A type annotation may be needed.��Known types of arguments: string * NumberStyles * CultureInfo��Candidates:� - Int32.TryParse(s: ReadOnlySpan<char>, style: NumberStyles, provider: IFormatProvider | null, result: byref<int>) : bool� - Int32.TryParse(s: ReadOnlySpan<char>, style: NumberStyles, provider: IFormatProvider | null, result: byref<int>, charsConsumed: byref<int>) : bool� - Int32.TryParse(s: string | null, style: NumberStyles, provider: IFormatProvider | null, result: byref<int>) : bool� - Int32.TryParse(s: string | null, style: NumberStyles, provider: IFormatProvider | null, result: byref<int>, charsConsumed: byref<int>) : bool [/__w/1/s/src/fsharp/src/Compiler/FSharp.Compiler.Service.fsproj::TargetFramework=net11.0]

@T-Gro this likely needs reaction to dotnet/runtime#130210
FYI @tannergooding

@tannergooding

tannergooding commented Jul 9, 2026

Copy link
Copy Markdown
Member

Ah, that is an unfortunate break in the F# type inference (but understandably something that can occur with any new overload addition)

IIRC you can resolve like this if you want to keep the existing 3 line match syntax

-             match Int32.TryParse(rightMost, NumberStyles.Integer, CultureInfo.InvariantCulture) with 
+             match (Int32.TryParse(rightMost, NumberStyles.Integer, CultureInfo.InvariantCulture) : bool * int) with 
              | true, n -> n
              | false, _ -> 0 // looks like it's non-generic

and otherwise break it down to:

              let mutable n = 0
              match Int32.TryParse(rightMost, NumberStyles.Integer, CultureInfo.InvariantCulture, &n) with
              | true -> n
              | false -> 0

@T-Gro

T-Gro commented Jul 9, 2026

Copy link
Copy Markdown
Member

Yeah, it is why we are (from a type-inferred language perspective) often unhappy with any "lets use new overloads as our primary API design technique" in general.

I would be happy to change the compiler if there was any indication of the "main" (or OG) overload, but I cannot infer any rule for that unfortunately.

Given this doesn`t just break the FSharp compiler but all FSharp users, is there any chance to reconsider the placement of specialized features like this? Given this sits next to a very basic API? e.g. extension methods in a dedicated namespace come to mind.

Its not that we are against evolution - but here the "fix" objectively leads to worse F# code even for people not using those new APIs (similar for other scenarios from the past, where a "fix" lead to dropping type inference and annotating parameters).

@tannergooding

tannergooding commented Jul 9, 2026

Copy link
Copy Markdown
Member

I would be happy to change the compiler if there was any indication of the "main" (or OG) overload, but I cannot infer any rule for that unfortunately.

I'm not quite sure on this part.... There is a clear difference between:

match Int32.TryParse(rightMost, NumberStyles.Integer, CultureInfo.InvariantCulture) with 
| true, result -> result
| false, _ -> 0 // looks like it's non-generic

and

match Int32.TryParse(rightMost, NumberStyles.Integer, CultureInfo.InvariantCulture) with 
| true, result, consumed -> result
| false, _, _ -> 0 // looks like it's non-generic

That is, the former is explicitly a 2 item tuple and the latter a 3 item tuple. It is perhaps more surprising that the current syntax is allowed to be ambiguous at all, particularly given that it isn't otherwise legal code.

In other words, given the below and that T2 miscompiles because the number of tuple items mismatches, F# should have no issue disambiguating these in T3 since it can only match the 2 item tuple.

image

Given this doesn`t just break the FSharp compiler but all FSharp users, is there any chance to reconsider the placement of specialized features like this? Given this sits next to a very basic API? e.g. extension methods in a dedicated namespace come to mind.

It's not really specialized and is rather a core and highly requested feature that is common in other ecosystems and where the disconnected and limited UTF-8 version that lives in Utf8Parser is heavily used.

Is there any way we can annotate these today to get F# to do the "right" thing?

If F# truly has no way, then we'd probably need to have these new overloads explicitly implemented so they are still accessible via generic math (where T : INumberBase<T>), which should allow it to ship and still be accessible.

Then once F# gets a disambiguation in (either some attribute we can annotate these with or more ideally it just working since this should be unambiguous) we can get them exposed directly on the types

@tannergooding

Copy link
Copy Markdown
Member

-- To be clear, I am already working on the change to avoid the F# break here for now, while still allowing the feature to ship. Should have it up shortly

…to be explicitly implemented to avoid breaking F#
@tannergooding

Copy link
Copy Markdown
Member

Pushed up the commit that makes the relevant APIs explicitly implemented, which should resolve the F# break and still allow the functionality to be accessible via T.TryParse(...) given where T : INumberBase<T>

@dotnet-maestro

Copy link
Copy Markdown
Contributor Author

Caution

🛑 Codeflow Paused — Conflict detected

A conflict was detected when trying to update this PR with changes from build 322260 of https://github.com/dotnet/runtime/tree/6c5849144dc8a23aa0760080d6f7784fed60da37.

💡 You can either merge the PR without getting these new updates or manually flow them in and resolve the conflicts so that automated codeflow can resume for this PR.

The conflicts in the following files need to be manually resolved:

  • src/libraries/System.Runtime.Numerics/src/System/Numerics/Complex.cs
    🔍 View file in dotnet/runtime vs VMR

ℹ️ To resolve the conflicts, please follow these steps:

  1. Clone the current repository

    git clone https://github.com/dotnet/dotnet
    cd dotnet
  2. Make sure your darc is up-to-date
    (version 1.1.0-beta.26359.1 or higher)

    # Linux / MacOS
    ./eng/common/darc-init.sh
    # or on Windows
    .\eng\common\darc-init.ps1
  3. Run from repo's git clone and follow the instructions provided by the command to stage the conflict locally

    darc vmr resolve-conflict --subscription 6458ae35-db00-43d0-af59-e57a01ca3120 

    This should apply the build 322260 with sources from 6c58491

  4. Resolve the conflicts, commit & push the changes

  5. Once pushed, the Codeflow verification check will turn green.
    If not, a new build might have flown into the PR and you might need to run the command above again.

💡 You may consult the FAQ for more information or tag @dotnet/prodconsvcs for assistance.

@dotnet-maestro

Copy link
Copy Markdown
Contributor Author

Note

PRs from original repository included in this codeflow update:

💡 You may consult the FAQ for more information or tag @dotnet/prodconsvcs for assistance.

Diff: https://github.com/dotnet/runtime/compare/6c5849144dc8a23aa0760080d6f7784fed60da37..6c5849144dc8a23aa0760080d6f7784fed60da37

From: dotnet/runtime@6c58491
To: dotnet/runtime@6c58491

The following files had conflicts that were resolved by a user:

- src/runtime/src/libraries/System.Runtime.Numerics/src/System/Numerics/Complex.cs
@T-Gro

T-Gro commented Jul 10, 2026

Copy link
Copy Markdown
Member

@tannergooding : Thank you greatly for making a patch for this 👍 .

For the long term mechanics:

Method resolution in F# cannot make assumptions based on later usage, as that might be type inferred as well.
let x = Int32.TryParse(rightMost, NumberStyles.Integer, CultureInfo.InvariantCulture)
Is x a pair or a triple here? No way to tell.

One way to indicate the "default" here would be OverloadResolutionPriorityAttribute (ORPA) which's support incl. multiple outs we could land in F# and it would be a general mechanism, not just a fix for this single scenario. It still relies on that attribute being applied that way in the runtime libraries👍 .

C# would not be affected, since with explicit hand-written out .. there is no conflict to resolve.
(the attribute is applied in language-specific scenarios already, e.g. its today's applications already assume compiler support for CallerArgumentExpression etc.)

Another option to resolve this particular occasion would be to describe the behavior via a dedicated method name instead of a flag and overloads.
From a "make illegal state unrepresentable" perspective it makes more sense - right now the usefulness of the overloads is tightly coupled to specific value of NumberStyles.

@tannergooding

Copy link
Copy Markdown
Member

@akoeplinger, this looks ready to approve/merge

@dotnet-maestro
dotnet-maestro Bot merged commit 6d4e1f2 into main Jul 10, 2026
16 checks passed
@dotnet-maestro
dotnet-maestro Bot deleted the darc-main-9be1d1d2-5f5d-4fad-9187-7bf8bcc56feb branch July 10, 2026 20:44
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.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.