{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/9039","repository_url":"https://api.github.com/repos/dotnet/roslyn","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/9039/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/9039/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/9039/events","html_url":"https://github.com/dotnet/roslyn/issues/9039","id":135675587,"number":9039,"title":"Request: make C# 7's discriminated unions compatible with F#","user":{"login":"DavidArno","id":196899,"avatar_url":"https://avatars.githubusercontent.com/u/196899?v=3","gravatar_id":"","url":"https://api.github.com/users/DavidArno","html_url":"https://github.com/DavidArno","followers_url":"https://api.github.com/users/DavidArno/followers","following_url":"https://api.github.com/users/DavidArno/following{/other_user}","gists_url":"https://api.github.com/users/DavidArno/gists{/gist_id}","starred_url":"https://api.github.com/users/DavidArno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DavidArno/subscriptions","organizations_url":"https://api.github.com/users/DavidArno/orgs","repos_url":"https://api.github.com/users/DavidArno/repos","events_url":"https://api.github.com/users/DavidArno/events{/privacy}","received_events_url":"https://api.github.com/users/DavidArno/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Area-Language%20Design","name":"Area-Language Design","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2016-02-23T08:57:50Z","updated_at":"2016-02-24T15:24:35Z","closed_at":null,"body":"Assuming C# 7 supports discriminated unions, then, if I define the following in F#:\r\n\r\n```fs\r\ntype Shape =\r\n    | Rectangle of width : float * length : float\r\n    | Circle of radius : float\r\n    | Line of length: float\r\n```\r\n\r\nthen C#'s pattern matching features should support that type as a sealed ADT type set and it should handle it just as if I'd defined it in C# as:\r\n\r\n```cs\r\nabstract sealed class Shape\r\n{\r\n    class Rectangle(float width, float length);\r\n    class Circle(float radius);\r\n    class Line(float length);\r\n}\r\n```\r\n\r\nIf possible, the two definitions should generate the same IL.\r\n\r\nFurther, whilst there will likely be practical problems around this extra idea, the `option` type in `Microsoft.FSharp.Core` should be used by the new pattern matching features to, for example, avoid having to use `out` parameters with the new `is` operator as discussed in [#9005](https://github.com/dotnet/roslyn/issues/9005)."},"comment":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/comments/188304495","html_url":"https://github.com/dotnet/roslyn/issues/9039#issuecomment-188304495","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/9039","id":188304495,"user":{"login":"svick","id":287848,"avatar_url":"https://avatars.githubusercontent.com/u/287848?v=3","gravatar_id":"","url":"https://api.github.com/users/svick","html_url":"https://github.com/svick","followers_url":"https://api.github.com/users/svick/followers","following_url":"https://api.github.com/users/svick/following{/other_user}","gists_url":"https://api.github.com/users/svick/gists{/gist_id}","starred_url":"https://api.github.com/users/svick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svick/subscriptions","organizations_url":"https://api.github.com/users/svick/orgs","repos_url":"https://api.github.com/users/svick/repos","events_url":"https://api.github.com/users/svick/events{/privacy}","received_events_url":"https://api.github.com/users/svick/received_events","type":"User","site_admin":false},"created_at":"2016-02-24T15:24:35Z","updated_at":"2016-02-24T15:24:35Z","body":"@HaloFour \r\n\r\n> I've been toying around with this a little and I've been unsuccessful at defining a C# class that F# will recognize as an ADT as is. […] I am probably still missing something, but the F# compiler seems very finicky.\r\n\r\nI believe what you're missing is the undocumented `FSharpSignatureData` resource that the F# compiler emits to assemblies. It contains, among other things, additional metadata about F# types, like what its F# type is."}}