Skip to content

Conversation

@T-Gro
Copy link
Member

@T-Gro T-Gro commented Jul 30, 2024

With the nullness feature being added, there is a new constraint solving codepath for nullness-related mismatches.
All nullness issues were warnings by default.

However, together with the 'supports null' constraint (e.g. matching on null, assigning null), this could lead to unsound F# code, e.g. by assigning null to an int.

This changes the logic by keeping it an error if an unsound type is inferred to have the 'null' constraint (coming from generics, assignment, matching).

Fixes #17423

let test = 
    match null with
    | null -> true
    | 42 -> false

@T-Gro T-Gro requested a review from a team as a code owner July 30, 2024 11:36
@github-actions
Copy link
Contributor

github-actions bot commented Jul 30, 2024

⚠️ Release notes required, but author opted out

Warning

Author opted out of release notes, check is disabled for this pull request.
cc @dotnet/fsharp-team-msft

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

Labels

NO_RELEASE_NOTES Label for pull requests which signals, that user opted-out of providing release notes

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Nullness issue - matching null with an int must be an error, not just a warning

4 participants