Skip to content

FS-1093 op_Implicit 3395 warnings missing for constructors and potentially inconsistent #13437

@NinoFloris

Description

@NinoFloris

Take the following example. Compiled with <OtherFlags>$(OtherFlags) --warnon:3395</OtherFlags> it produces no warnings on the constructor.

open System

// Minimized copy for demonstration of Microsoft.Extensions.Primitives.StringValues
type StringValues(v: string) =
    static member op_Implicit(values: StringValues): string = ""
    
type Foo(_v: Nullable<int>) =
    member val Test: Nullable<int> = 0 with get,set // Warning for 3391 as I would have interpreted it.
    member val StringValue: string = "" with get,set
    
    static member Create() =
      let value = 1
      let instance = Foo(value, Test = value) // No warning on either the argument or the property setter?
      instance.Test <- value // No warning for 3395 and 3391?
      instance.StringValue <- StringValues("1") // Warning for 3395
      
      let mutable test: Nullable<int> = value // Warning for 3391 as I would have interpreted it.
      
      // Warning for 3391 but it's syntactically identical to the line that had no warning and one that had 3395???
      test <- 1 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingArea-Compiler-Checking-OverloadsOverload resolution, implicit conversions, extension method priority, op_ImplicitBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.

    Type

    No fields configured for Bug.

    Projects

    Status
    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions