Chore :: Remove #IF NULLABLE, MaybeNull and other leftovers from bootstrap times of Nullable feature#19235
Merged
Chore :: Remove #IF NULLABLE, MaybeNull and other leftovers from bootstrap times of Nullable feature#19235
Conversation
Remove all #if BUILDING_WITH_LKG || BUILD_FROM_SOURCE conditionals from prim-types.fsi (7 blocks), prim-types.fs (2 blocks), event.fsi (2 blocks), and event.fs (2 blocks). For each block, kept the #else branch which includes: - IsError=true in CompilerMessage attributes (prim-types.fsi) - 'not null' type constraints on delegate types (all files) These conditionals were only needed during F# 9 development when the shipped .NET SDK didn't yet understand NRT. Now that NRT is stable, this code can be unconditionally included.
- Update NullnessShims.fs: nullSafeEquality and NonEmptyString now use 'T | null - Update lib.fs/fsi: dispose and DisposablesTracker.Register use 'T | null - Update illib.fs: reportTime and DelayInitArrayMap use nullable types - Update FileSystem.fs: isInvalidPath/Filename/Directory use pattern matching - Update Activity.fs: escapeStringForCsv and appendWithLeadingComma use nullable - Update Cancellable.fs: Using member uses _ | null - Update LruCache.fs: removeCollected uses nullable LinkedListNode - Minor formatting fix in event.fs (fantomas) Note: Cancellable.fsi retains MaybeNull in signature for backwards compatibility with consuming code (changing it causes FS3261 nullness errors downstream). The MaybeNull type alias is kept in NullnessShims.fs for this purpose.
Replace all MaybeNull<'T> usages with the canonical 'T | null syntax in FSharp.Build implementation files: - Fsc.fs: 33 replacements - Fsi.fs: 11 replacements - FSharpCommandLineBuilder.fs: 2 method signature replacements - WriteCodeFragment.fs: 2 replacements The MaybeNull type definition is retained for backward compatibility. Type annotations added to match expressions returning null to ensure proper type inference with nullable types.
- Remove unused MaybeNull type alias definition from FSharpCommandLineBuilder.fs - Remove unused (^) null-propagation operator from NullnessShims.fs - Inline (^) usage in fsi.fs with direct null check pattern - All FSharp.Build files now use 'T | null syntax directly
Contributor
|
abonie
approved these changes
Jan 22, 2026
Member
Author
|
/run fantomas |
Contributor
🔧 CLI Command Report
✅ Patch applied: |
This was referenced Jan 23, 2026
bbatsov
added a commit
to bbatsov/fsharp
that referenced
this pull request
Feb 18, 2026
The BUILDING_WITH_LKG constant was left behind after dotnet#19235 removed all the #if conditionals that referenced it. It's now defined but never used anywhere in the source. Remove it from both props files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.