Skip to content

Conversation

@T-Gro
Copy link
Member

@T-Gro T-Gro commented Jan 23, 2025

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 warnings
let workWithResource (getD:int -> (IDisposable|null)) =
    use _ = getD 15
    15

@github-actions
Copy link
Contributor

github-actions bot commented Jan 23, 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 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 owner February 3, 2025 11:06
@psfinaki psfinaki merged commit 3195041 into main Feb 3, 2025
33 checks passed
@T-Gro T-Gro deleted the bugfix/allow-use-on-nullable-disposable branch February 4, 2025 13:03
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.

5 participants