{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/1103","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/1103/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/1103/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/1103/events","html_url":"https://github.com/dotnet/roslyn/issues/1103","id":60165650,"number":1103,"title":"Array.Empty<T>() optimization issues","user":{"login":"controlflow","id":194765,"avatar_url":"https://avatars.githubusercontent.com/u/194765?v=3","gravatar_id":"","url":"https://api.github.com/users/controlflow","html_url":"https://github.com/controlflow","followers_url":"https://api.github.com/users/controlflow/followers","following_url":"https://api.github.com/users/controlflow/following{/other_user}","gists_url":"https://api.github.com/users/controlflow/gists{/gist_id}","starred_url":"https://api.github.com/users/controlflow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/controlflow/subscriptions","organizations_url":"https://api.github.com/users/controlflow/orgs","repos_url":"https://api.github.com/users/controlflow/repos","events_url":"https://api.github.com/users/controlflow/events{/privacy}","received_events_url":"https://api.github.com/users/controlflow/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Area-Compilers","name":"Area-Compilers","color":"5319e7"},{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Bug","name":"Bug","color":"fc2929"},{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Compatibility","name":"Compatibility","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/dotnet/roslyn/milestones/6","html_url":"https://github.com/dotnet/roslyn/milestones/1.0-rc2","labels_url":"https://api.github.com/repos/dotnet/roslyn/milestones/6/labels","id":956299,"number":6,"title":"1.0-rc2","description":"\r\n\r\n<!---\r\n@huboard:{\"order\":0.5}\r\n-->\r\n","creator":{"login":"theoy","id":8222470,"avatar_url":"https://avatars.githubusercontent.com/u/8222470?v=3","gravatar_id":"","url":"https://api.github.com/users/theoy","html_url":"https://github.com/theoy","followers_url":"https://api.github.com/users/theoy/followers","following_url":"https://api.github.com/users/theoy/following{/other_user}","gists_url":"https://api.github.com/users/theoy/gists{/gist_id}","starred_url":"https://api.github.com/users/theoy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theoy/subscriptions","organizations_url":"https://api.github.com/users/theoy/orgs","repos_url":"https://api.github.com/users/theoy/repos","events_url":"https://api.github.com/users/theoy/events{/privacy}","received_events_url":"https://api.github.com/users/theoy/received_events","type":"User","site_admin":false},"open_issues":36,"closed_issues":159,"state":"open","created_at":"2015-01-29T06:19:12Z","updated_at":"2015-03-07T00:33:54Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-03-06T22:05:51Z","updated_at":"2015-03-07T00:41:40Z","closed_at":null,"body":"```c#\r\nusing System;\r\nusing System.Linq.Expressions;\r\n\r\nnamespace System {\r\n    public static class Array {\r\n        public static T[] Empty<T>() => new T[0];\r\n    }\r\n}\r\n\r\npublic class C {\r\n    public static void M(params int[] xs) {\r\n        // expression tree with empty-arguments-params-call\r\n        Expression<Action> f = () => M();\r\n    }\r\n}\r\n```\r\n\r\nProduces this code:\r\n```c#\r\npublic class C {\r\n    public static void M(params int[] xs) {\r\n        Expression.Lambda<Action>(\r\n            Expression.Call(null, methodof(C.M(int[])), new Expression[] {\r\n                Expression.Call(null, methodof(System.Array.Empty()), new Expression[0])\r\n            }),\r\n            new ParameterExpression[0]);\r\n    }\r\n}\r\n```\r\n\r\n1. This C# 6.0 change can break various LINQ quotation translators, since nobody knows what `System.Array.Empty<T>` method actually do and how to translate it. We should disable this optimization inside expression trees.\r\n\r\n2. When expression tree code is lowered, we can see a lot of `new Expression[0]` or `new ParameterExpression[0]` expressions (passed to `params` parameters) produced - exactly the cases for this optimization."},"comment":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/comments/77662213","html_url":"https://github.com/dotnet/roslyn/issues/1103#issuecomment-77662213","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/1103","id":77662213,"user":{"login":"stephentoub","id":2642209,"avatar_url":"https://avatars.githubusercontent.com/u/2642209?v=3","gravatar_id":"","url":"https://api.github.com/users/stephentoub","html_url":"https://github.com/stephentoub","followers_url":"https://api.github.com/users/stephentoub/followers","following_url":"https://api.github.com/users/stephentoub/following{/other_user}","gists_url":"https://api.github.com/users/stephentoub/gists{/gist_id}","starred_url":"https://api.github.com/users/stephentoub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephentoub/subscriptions","organizations_url":"https://api.github.com/users/stephentoub/orgs","repos_url":"https://api.github.com/users/stephentoub/repos","events_url":"https://api.github.com/users/stephentoub/events{/privacy}","received_events_url":"https://api.github.com/users/stephentoub/received_events","type":"User","site_admin":false},"created_at":"2015-03-07T00:41:40Z","updated_at":"2015-03-07T00:41:40Z","body":"We'd discussed this back before I checked in the optimization, and the decision then was that it was acceptable and we went ahead with it. Is that no longer the case? I'd never intended for it to apply to expression lamdas and can fix that."}}