-
Notifications
You must be signed in to change notification settings - Fork 830
Open
Open
Copy link
Labels
Area-LangService-CodeFixesCode fixes associated with diagnosticsCode fixes associated with diagnosticsBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.(Internal MS Team use only) Describes an issue with limited impact on existing code.
Milestone
Description
Here is the half-done maybe CE
Repro steps
Here is the half-done maybe CE, extension for it that adds Bind-overload and usage attempt:
namespace Case1
module MaybeBuilder =
type MaybeBuilder() =
member inline _.Bind(optionValue: 'T option, f) =
match optionValue with
| None -> None
| Some value -> f value
member inline _.Return maybeNull =
if isNull maybeNull then None else Some maybeNull
member inline _.Delay f = f
member inline _.Run f = f()
let maybe = MaybeBuilder()
module MaybeBuilderExtension =
open MaybeBuilder
type MaybeBuilder with
member inline _.Bind(maybeNull: 'T, f) =
if isNull maybeNull then None else f maybeNull
module Usage =
open MaybeBuilder
open MaybeBuilderExtension // TODO: false positive
let foo (s: string) =
maybe {
let! a = s
return a
}Visual Studio marks open MaybeBuilderExtension as safe to remove.

However it would break compilation of code because we actually use Bind from extension.
Expected behavior
open for builder extension isn't marked as unnecessary.
Actual behavior
It's marked as unnecessary.
Known workarounds
.
Related information
.NET SDK: 7.0.403
Visual Studio 17.7.6
smoothdeveloper and psfinaki
Metadata
Metadata
Assignees
Labels
Area-LangService-CodeFixesCode fixes associated with diagnosticsCode fixes associated with diagnosticsBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.(Internal MS Team use only) Describes an issue with limited impact on existing code.