Repro steps
Run the following in fsi:
open System
type JsonValue = JNull
type JsonEncoding = JsonEncoding with
static member nullableE encoder (x: Nullable<'a>) = if x.HasValue then encoder x.Value else JNull
static member nullable codec = JsonEncoding.nullableE codec
Expected behavior
Compile OK
Actual behavior
~vs3D37.fsx(7,37): error FS0193: Type constraint mismatch. The type
''a'
is not compatible with type
'Nullable<'a>'
Known workarounds
- Don't upgrade Visual Studio
- Transform the first method to a let bind
Related information
- Operating system: Windows
- Editing Tools (e.g. Visual Studio Version, Visual Studio): Works in VS 16.8.3, doesn't work in VS 16.9.3
Repro steps
Run the following in fsi:
Expected behavior
Compile OK
Actual behavior
Known workarounds
Related information