Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nullness - option<> must be indicated as nullable in IL for C# consumers #17528

Merged
merged 13 commits into from
Aug 19, 2024

Conversation

T-Gro
Copy link
Member

@T-Gro T-Gro commented Aug 13, 2024

F# option<> Has UseNullAsTrueValueAttribute on it, making the representation of None null in IL.
Therefore, even if the type is not considered null (assignment, pattern matching, ..) in F#, it must reported as nullable for C# consumers.
This can be also demonstrated at runtime by using the reflection helpers at NullabilityInfoContext (test added).

This covers all types marked as UseNullAsTrueValue as well as (~legacy, not recommended under --checknulls+) types marked with AllowNull.

@T-Gro T-Gro requested a review from a team as a code owner August 13, 2024 13:29
Copy link
Contributor

github-actions bot commented Aug 13, 2024

❗ Release notes required


✅ Found changes and release notes in following paths:

Change path Release notes path Description
src/Compiler docs/release-notes/.FSharp.Compiler.Service/9.0.100.md

@T-Gro T-Gro linked an issue Aug 15, 2024 that may be closed by this pull request
7 tasks
@T-Gro T-Gro enabled auto-merge (squash) August 19, 2024 13:40
@T-Gro T-Gro merged commit d90885c into main Aug 19, 2024
30 checks passed
@T-Gro T-Gro deleted the nullness-NullabilityInfoContext-Option-type branch September 9, 2024 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Nullness issue - Option<string> is marked as NotNull using NullabilityInfoContext
3 participants