Skip to content

Bugfix :: Support for 'use' on a nullable IDisposable - #18262

Merged
psfinaki merged 3 commits into
mainfrom
bugfix/allow-use-on-nullable-disposable
Feb 3, 2025
Merged

Bugfix :: Support for 'use' on a nullable IDisposable#18262
psfinaki merged 3 commits into
mainfrom
bugfix/allow-use-on-nullable-disposable

Conversation

@T-Gro

Copy link
Copy Markdown
Member

Codegen for use does emit a defensive null check for the resource, therefore the argument to use can be anything which can subsume to IDisposable|null, and does not have to strictly enforce an IDisposable.

// Should work without warningsletworkWithResource(getD:int ->(IDisposable|null))=use _ = getD 1515

@github-actions

github-actionsBot commented Jan 23, 2025

Copy link
Copy Markdown
Contributor

❗ Release notes required


✅ Found changes and release notes in following paths:

Change pathRelease notes pathDescription
src/Compilerdocs/release-notes/.FSharp.Compiler.Service/9.0.300.md

@T-Gro
T-Gro marked this pull request as ready for review February 3, 2025 11:06
@T-Gro
T-Gro requested a review from a team as a code ownerFebruary 3, 2025 11:06
0101
0101 approved these changes Feb 3, 2025
@psfinaki
psfinaki merged commit 3195041 into mainFeb 3, 2025
@T-Gro
T-Gro deleted the bugfix/allow-use-on-nullable-disposable branch February 4, 2025 13:03
Sign up for freeto 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.

4 participants

@T-Gro@0101@abonie@psfinaki