Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression with constraints produced by Nullable #11344

Closed
gusty opened this issue Apr 1, 2021 · 3 comments · Fixed by #11351
Closed

Regression with constraints produced by Nullable #11344

gusty opened this issue Apr 1, 2021 · 3 comments · Fixed by #11351
Assignees
Labels
Impact-High (Internal MS Team use only) Describes an issue with extreme impact on existing code. Regression
Milestone

Comments

@gusty
Copy link
Contributor

gusty commented Apr 1, 2021

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
@cartermp
Copy link
Contributor

cartermp commented Apr 1, 2021

Only speculative, but #10582 may be related, since this was the only tweak that I know of from VS 16.8 until VS 16.9. Confirmed that the old code used to work, but now does not.

@cartermp cartermp added Area-Compiler Regression Impact-High (Internal MS Team use only) Describes an issue with extreme impact on existing code. labels Apr 1, 2021
@cartermp cartermp added this to the 16.10 milestone Apr 1, 2021
@cartermp
Copy link
Contributor

cartermp commented Apr 1, 2021

cc @TIHan, @dsyme

@TIHan TIHan self-assigned this Apr 1, 2021
@TIHan
Copy link
Member

TIHan commented Apr 1, 2021

I can confirm that #10582 is what caused this regression. Am looking at this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Impact-High (Internal MS Team use only) Describes an issue with extreme impact on existing code. Regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants