Repository navigation
C# fields in SRTP support - #19417
Open
vzarytovskii wants to merge 1 commit into
Open
vzarytovskii wants to merge 1 commit into
vzarytovskii wants to merge 1 commit into
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
vzarytovskii
force-pushed
the
dev/vlza/csharp-class-fields-srtp
branch
from
March 17, 2026 12:26
0716cbc to
eeb5b48
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment was marked as off-topic.
This comment was marked as off-topic.
SRTP property constraints now pick up public .NET fields: instance, static, inherited, generic and const ones, so 'T.MaxValue works for primitives too. We only use a field when nothing else matches, so existing code resolves the same way. Setting a readonly or const field gives you a proper error, obsolete fields warn, and volatile fields get the volatile. prefix. FSharp.Core never uses this. Also, both under preview: - direct access to volatile .NET fields gets the volatile. prefix - you can write x.Prop <- v through an SRTP setter constraint
vzarytovskii
force-pushed
the
dev/vlza/csharp-class-fields-srtp
branch
from
November 12, 2026 11:18
eeb5b48 to
82fcec7
Compare
Member
Author
|
@T-Gro PTAL, I've finally found time to finish it and fix the annoying setter syntax for whole SRTP. |
vzarytovskii
enabled auto-merge (squash)
November 12, 2026 13:54
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements fsharp/fslang-suggestions#1323
SRTP property constraints now pick up public .NET fields: instance, static, inherited, generic and const ones, so 'T.MaxValue works for primitives too. We only use a field when nothing else matches, so existing code resolves the same way. Setting a readonly or const field gives you a proper error, obsolete fields warn, and volatile fields get the
volatile.prefix. FSharp.Core never uses this.Also, both under preview:
x.Prop <- vthrough an SRTP setter constraint