{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/14541","repository_url":"https://api.github.com/repos/dotnet/roslyn","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/14541/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/14541/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/14541/events","html_url":"https://github.com/dotnet/roslyn/issues/14541","id":183224769,"number":14541,"title":"Possibly incorrect logic in SymbolExtensions.IsDefaultValueTypeConstructor","user":{"login":"AlekseyTs","id":10522107,"avatar_url":"https://avatars.githubusercontent.com/u/10522107?v=3","gravatar_id":"","url":"https://api.github.com/users/AlekseyTs","html_url":"https://github.com/AlekseyTs","followers_url":"https://api.github.com/users/AlekseyTs/followers","following_url":"https://api.github.com/users/AlekseyTs/following{/other_user}","gists_url":"https://api.github.com/users/AlekseyTs/gists{/gist_id}","starred_url":"https://api.github.com/users/AlekseyTs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlekseyTs/subscriptions","organizations_url":"https://api.github.com/users/AlekseyTs/orgs","repos_url":"https://api.github.com/users/AlekseyTs/repos","events_url":"https://api.github.com/users/AlekseyTs/events{/privacy}","received_events_url":"https://api.github.com/users/AlekseyTs/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/Language-VB","name":"Language-VB","color":"207de5"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/dotnet/roslyn/milestones/16","html_url":"https://github.com/dotnet/roslyn/milestones/2.0%20(RTM)","labels_url":"https://api.github.com/repos/dotnet/roslyn/milestones/16/labels","id":1571384,"number":16,"title":"2.0 (RTM)","description":"","creator":{"login":"davkean","id":1103906,"avatar_url":"https://avatars.githubusercontent.com/u/1103906?v=3","gravatar_id":"","url":"https://api.github.com/users/davkean","html_url":"https://github.com/davkean","followers_url":"https://api.github.com/users/davkean/followers","following_url":"https://api.github.com/users/davkean/following{/other_user}","gists_url":"https://api.github.com/users/davkean/gists{/gist_id}","starred_url":"https://api.github.com/users/davkean/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davkean/subscriptions","organizations_url":"https://api.github.com/users/davkean/orgs","repos_url":"https://api.github.com/users/davkean/repos","events_url":"https://api.github.com/users/davkean/events{/privacy}","received_events_url":"https://api.github.com/users/davkean/received_events","type":"User","site_admin":false},"open_issues":308,"closed_issues":80,"state":"open","created_at":"2016-02-08T21:54:04Z","updated_at":"2016-10-17T18:35:20Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2016-10-15T18:25:37Z","updated_at":"2016-10-17T18:35:56Z","closed_at":null,"body":"Relevant portion of code:\r\n```\r\n            Dim container As SourceNamedTypeSymbol = TryCast(method.ContainingType, SourceNamedTypeSymbol)\r\n            If container Is Nothing Then\r\n                ' synthesized ctor Not from source -> must be default\r\n                Return True\r\n            End If\r\n\r\n            ' if we are here we have a struct in source for which a parameterless ctor was not provided by the user.\r\n            ' So, are we ok with default behavior?\r\n            ' Returning false will result in a production of synthesized parameterless ctor \r\n\r\n            ' this ctor is not default if we have instance initializers\r\n            Return container.InstanceInitializers.IsDefaultOrEmpty\r\n```\r\n\r\nWhen we are dealing with constructed type, a cast to SourceNamedTypeSymbol will fail. This, however, doesn't mean that the method is not declared in source. This can lead to possibly incorrect result.\r\n\r\nThis code might be related to supporting explicit parameter-less constructors in structures, but this feature got pulled from the compiler. If that is the case, we should consider removing the obsolete logic.\r\n\r\nCC @VSadov "},"comment":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/comments/254294030","html_url":"https://github.com/dotnet/roslyn/issues/14541#issuecomment-254294030","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/14541","id":254294030,"user":{"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},"created_at":"2016-10-17T18:35:56Z","updated_at":"2016-10-17T18:35:56Z","body":"There appears to be more code in the compilers to support the declaration of structs with field initializers and/or a default constructor. For example, code starting with the following in `MethodCompiler.cs`...\r\n\r\n```cs\r\n                        // generated struct constructors should ensure that all fields are assigned (even those that do not have initializers)\r\n                        var container = methodSymbol.ContainingType as SourceMemberContainerTypeSymbol;\r\n                        if (container != null &&\r\n                            container.IsStructType() &&\r\n                            methodSymbol.IsImplicitInstanceConstructor)\r\n                        {\r\n```\r\n"}}
{"actor":{"display_login":"gafter"}}