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

Bugfix :: Nullness :: Unsafe cast no longer requires generic type to be not null typar #18343

Conversation

T-Gro
Copy link
Member

@T-Gro T-Gro commented Feb 27, 2025

Fixes #18275 .

The logic for downcast required for the target type to subsume the source.
When solving type inference, this also meant that obj :?> T it added a not null constraint to T, unless the source was objnull.
This change relaxes the environment and allows obj :?> .. casting without constraints.

Doing that also meant getting rid of some duplicate diagnostics we had captured in tests, as nullness is dealt with separately for downcasts/typetests with their own sets of messages.

@T-Gro T-Gro requested a review from a team as a code owner February 27, 2025 15:46
@T-Gro T-Gro linked an issue Feb 27, 2025 that may be closed by this pull request
7 tasks
Copy link
Contributor

github-actions bot commented Feb 27, 2025

❗ 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.300.md

@T-Gro T-Gro enabled auto-merge (squash) February 28, 2025 17:38
Copy link
Member

@KevinRansom KevinRansom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@T-Gro T-Gro merged commit 32c2764 into main Feb 28, 2025
33 checks passed
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 - Unsafe cast requires generic type to be non-null
3 participants