Skip to content

Null value returned from trait call #12386

Open
@gusty

Description

@gusty

There are some cases where an invalid value is returned from a trait call.

Repro steps

  1. Step A

try in fsi

type A = A with
    static member ($) (A, a: float  ) = 0.0
    static member ($) (A, a: decimal) = 0M
    static member ($) (A, a: 't     ) = 0

let inline call x = ($) A x

send it

  1. Step B

Now try this call 42.

Expected behavior

val it : float = 0.0

Actual behavior

val it : obj = <null>

Known workarounds

I haven't found one so far.

  • Operating system: Windows
  • FSI: F# Interactive version 11.4.2.0 for F# 5.0
  • Editing Tools: Visual Studio 2019

I didn't try in older versions, but I'm under the impression that this is a regression.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Compiler-SRTPbugs in SRTP inference, resolution, witness passing, code genBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.Regression

    Type

    Projects

    Status

    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions