{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/5023","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/5023/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/5023/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/5023/events","html_url":"https://github.com/dotnet/roslyn/issues/5023","id":104979068,"number":5023,"title":"REQUEST:  Pattern matching/better type inferencing with generics.","user":{"login":"TonyValenti","id":13609558,"avatar_url":"https://avatars.githubusercontent.com/u/13609558?v=3","gravatar_id":"","url":"https://api.github.com/users/TonyValenti","html_url":"https://github.com/TonyValenti","followers_url":"https://api.github.com/users/TonyValenti/followers","following_url":"https://api.github.com/users/TonyValenti/following{/other_user}","gists_url":"https://api.github.com/users/TonyValenti/gists{/gist_id}","starred_url":"https://api.github.com/users/TonyValenti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TonyValenti/subscriptions","organizations_url":"https://api.github.com/users/TonyValenti/orgs","repos_url":"https://api.github.com/users/TonyValenti/repos","events_url":"https://api.github.com/users/TonyValenti/events{/privacy}","received_events_url":"https://api.github.com/users/TonyValenti/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dotnet/roslyn/labels/4%20-%20In%20Review","name":"4 - In Review","color":"CCCCCC"},{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Area-Language%20Design","name":"Area-Language Design","color":"5319e7"},{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Feature%20Request","name":"Feature Request","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"gafter","id":3804346,"avatar_url":"https://avatars.githubusercontent.com/u/3804346?v=3","gravatar_id":"","url":"https://api.github.com/users/gafter","html_url":"https://github.com/gafter","followers_url":"https://api.github.com/users/gafter/followers","following_url":"https://api.github.com/users/gafter/following{/other_user}","gists_url":"https://api.github.com/users/gafter/gists{/gist_id}","starred_url":"https://api.github.com/users/gafter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gafter/subscriptions","organizations_url":"https://api.github.com/users/gafter/orgs","repos_url":"https://api.github.com/users/gafter/repos","events_url":"https://api.github.com/users/gafter/events{/privacy}","received_events_url":"https://api.github.com/users/gafter/received_events","type":"User","site_admin":false},"milestone":null,"comments":18,"created_at":"2015-09-04T22:15:15Z","updated_at":"2016-01-10T02:36:16Z","closed_at":null,"body":"Hi Roslyn Team:\r\nWhen I was reading one of the feature requests from earlier:\r\nhttps://github.com/dotnet/roslyn/issues/2212#issuecomment-137754530\r\n\r\nIt made me think of something I have really been wanting as of late:\r\n\r\nPattern matching/better type inferencing with generics.\r\n\r\nToday I can write code like this:\r\n```\r\n        private static void Foo<T, X>(T Object) where T : IEnumerable<X>, IComparable<X> {\r\n            //Do Something\r\n        }\r\n\r\n        private class MyClass : IComparable<String>, IEnumerable<String> {\r\n            int IComparable<string>.CompareTo(string other) {\r\n                throw new NotImplementedException();\r\n            }\r\n\r\n            IEnumerator IEnumerable.GetEnumerator() {\r\n                throw new NotImplementedException();\r\n            }\r\n\r\n            IEnumerator<string> IEnumerable<string>.GetEnumerator() {\r\n                throw new NotImplementedException();\r\n            }\r\n        }\r\n\r\n        private static void CallMyFunction() {\r\n            var C = new MyClass();\r\n\r\n            Foo<MyClass, String>(C);\r\n        }\r\n```\r\n\r\nThere is nastiness is in how I have to call the function.\r\n```\r\n        private static void CallMyFunction() {\r\n            var C = new MyClass();\r\n\r\n            Foo<MyClass, String>(C);\r\n        }\r\n```\r\n\r\nIn this example, I feel as though Foo should automatically figure out the type parameters and I should be able to call the method as follows:\r\n```\r\n        private static void CallMyFunction() {\r\n            var C = new MyClass();\r\n\r\n            Foo(C);\r\n        }\r\n```\r\n\r\n\r\n "},"comment":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/comments/170302194","html_url":"https://github.com/dotnet/roslyn/issues/5023#issuecomment-170302194","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/5023","id":170302194,"user":{"login":"Inverness","id":1755290,"avatar_url":"https://avatars.githubusercontent.com/u/1755290?v=3","gravatar_id":"","url":"https://api.github.com/users/Inverness","html_url":"https://github.com/Inverness","followers_url":"https://api.github.com/users/Inverness/followers","following_url":"https://api.github.com/users/Inverness/following{/other_user}","gists_url":"https://api.github.com/users/Inverness/gists{/gist_id}","starred_url":"https://api.github.com/users/Inverness/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Inverness/subscriptions","organizations_url":"https://api.github.com/users/Inverness/orgs","repos_url":"https://api.github.com/users/Inverness/repos","events_url":"https://api.github.com/users/Inverness/events{/privacy}","received_events_url":"https://api.github.com/users/Inverness/received_events","type":"User","site_admin":false},"created_at":"2016-01-10T02:36:16Z","updated_at":"2016-01-10T02:36:16Z","body":"A tool to upgrade code would certainly ease the burden and make the concept more attractive to code maintainers. In fact I'd say it's essential if you want to make backwards incompatible changes seem like a good idea to companies or organizations that have monolithic projects.\r\n\r\nIt's also fortunate that IL from older language versions will still work and will not create a debacle like Python 3. As long as you avoid that sort of binary incompatibility, the C# community will not catch fire too.\r\n\r\nAs @TonyValenti mentioned, I too was worried about how new features could be added in ways that don't create code messes.\r\n\r\nI'm guessing backwards incompatible changes will be tied to the C# language version you select at build time?"}}