Repository navigation
Remove Option.FromBoolean and fix its calls on the compile error too - #1039
Open
FreeApophis wants to merge 1 commit into
Open
FreeApophis wants to merge 1 commit into
FreeApophis wants to merge 1 commit into
Conversation
Option.FromBoolean (all three overloads), obsolete since 3.8.0, is removed from Funcky 4.0.0 together with its tests; the PublicAPI files record the removal. The code fix in Funcky.Analyzers stays as the migration aid, but a fix on the obsoletion warning alone never fires once the method is gone, so it now also handles the compile error CS0117 a call of the removed member reports. Without a bound overload the fix reads the overload off the arguments: a lambda, a method group or a Func<T> is the selector overload, everything else the value overload, and a selector whose return type cannot be told is left alone rather than risking the flattening Then applies. Closes #901 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This branch has not been deployed
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.
Closes #901. Stacked on #1037 (base
drop-eol-frameworks), because that PR deletes the PublicAPI files of the dropped frameworks which this one would otherwise have to touch as well. Retarget tomainonce #1037 is merged.Option.FromBoolean(all three overloads) andFuncky.Test/Monads/Option.FromBoolean.csare removed; every remaining TFM'sPublicAPI.Unshipped.txtgets the three*REMOVED*lines.OptionSomeWhereToThenRefactoringalready producesThenonly (done in Add bool.Then and obsolete Option.FromBoolean #997), nothing to change.FromBoolean→Thencode fix stays as the migration aid, but a fix on CS0618 alone is dead once the method is gone: a project on Funcky 4.0.0 gets CS0117 ('Option' does not contain a definition for 'FromBoolean') instead. The fix therefore handles both IDs now. For CS0117 the compiler binds no overload, so the fix reconstructs the call from the syntax and the types of the arguments:Func<T>-typed expression is the selector overload, everything else the value overload (a delegate given asitem:or with an explicit delegate type argument is the value overload and becomesvalue:, as before);Then(() => option)applies;SelectMany(Identity)around the call is recognized by name once the receiver is an error type;usinginsertion, the "would bind to anotherThen" guard and Fix-All work as for CS0618.OptionFromBooleanRemovedCodeFixTestmirrors the CS0618 cases against a stub withoutFromBoolean, plus block-bodied lambdas, method groups and a fully qualifiedFuncky.Monads.Optionreceiver.Thenparagraph in the option chapter updated.Verified locally: Release build of the solution with 0 warnings, Funcky.Analyzers.Test 256/256, Funcky.Test 1648/1648 on net11.0.
🤖 Generated with Claude Code