{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/10364","repository_url":"https://api.github.com/repos/dotnet/roslyn","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/10364/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/10364/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/10364/events","html_url":"https://github.com/dotnet/roslyn/issues/10364","id":146306615,"number":10364,"title":"Pattern matching `is` operator doesn't function correctly across assemblies.","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":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-06T12:59:29Z","updated_at":"2016-04-06T13:00:37Z","closed_at":null,"body":"**Version Used**: \r\nBuild of Visual Studio from the `features/patterns` branch as of 4th April 2016.\r\n\r\n**Steps to Reproduce**:\r\n**1** Within a new solution, create a library project, `TypeDeclarations`, with the `__DEMO_EXPERIMENTAL__` conditional compilation symbol set. Then create the following classes:\r\n\r\n```cs\r\nnamespace TypeDeclarations\r\n{\r\n    public class A\r\n    {\r\n        public int Prop1 { get; set; }\r\n    }\r\n\r\n    public class B\r\n    {\r\n        public static bool operator is(A a) => a.Prop1 == 0;\r\n    }\r\n\r\n    public class C\r\n    {\r\n        public int Prop2 { get; set; }\r\n\r\n        public static bool operator is(A a, out C c)\r\n        {\r\n            c = a.Prop1 != 0 ? new C { Prop2 = a.Prop1 } : null;\r\n            return a.Prop1 != 0;\r\n        }\r\n    }\r\n\r\n    public static class Patterns\r\n    {\r\n        public static int Pattern1(A a) => a is C(var c) ? c.Prop2 : 0;\r\n\r\n        public static int Pattern2(A a) =>\r\n            a match (\r\n                case C(var c) : c.Prop2\r\n                case B() : 0\r\n            );\r\n    }\r\n}\r\n```\r\n\r\n**2**  Create another, cmdline, project, `IsOperatorBugDemo`, again with `__DEMO_EXPERIMENTAL__` set. Create a main class, compile and run the code:\r\n```cs\r\nusing System;\r\nusing TypeDeclarations;\r\n\r\nnamespace IsOperatorBugDemo\r\n{\r\n    static class Program\r\n    {\r\n        static void Main()\r\n        {\r\n            Console.WriteLine(Patterns.Pattern1(new A()));\r\n            Console.WriteLine(Patterns.Pattern2(new A()));\r\n            Console.WriteLine(Patterns.Pattern1(new A { Prop1 = 1 }));\r\n            Console.WriteLine(Patterns.Pattern2(new A { Prop1 = 1 }));\r\n            Console.ReadLine();\r\n        }\r\n    }\r\n}\r\n```\r\n\r\n**3** Modify `Program.cs` in step 2 to the following and try to compile and run once more:\r\n```cs\r\nusing System;\r\nusing TypeDeclarations;\r\n\r\nnamespace IsOperatorBugDemo\r\n{\r\n    static class Program\r\n    {\r\n        static void Main()\r\n        {\r\n            Console.WriteLine(Pattern1(new A()));\r\n            Console.WriteLine(Pattern2(new A()));\r\n            Console.WriteLine(Pattern1(new A { Prop1 = 1 }));\r\n            Console.WriteLine(Pattern2(new A { Prop1 = 1 }));\r\n            Console.ReadLine();\r\n        }\r\n        private static int Pattern1(A a) => a is C(var c) ? c.Prop2 : 0;\r\n\r\n        private static int Pattern2(A a) =>\r\n            a match (\r\n                case C(var c) : c.Prop2\r\n                case B() : 0\r\n            );\r\n    }\r\n}\r\n```\r\n\r\n**Expected Behavior**:\r\nFor both steps 2 and 3, the output should be:\r\n```\r\n0\r\n0\r\n1\r\n1\r\n```\r\n**Actual Behavior**:\r\nFor step 2, the actual behaviour is as expected. For step 3, the IDE gives no \"red squiggles\" to indicate a problem, and the error list remains empty. The compilation fails though, with:\r\n```\r\nProgram.cs(16,50,16,58): error CS8157: No 'operator is' declaration in 'C' was found with 1 out parameters\r\nProgram.cs(16,61,16,62): error CS0165: Use of unassigned local variable 'c'\r\nProgram.cs(20,22,20,30): error CS8157: No 'operator is' declaration in 'C' was found with 1 out parameters\r\nProgram.cs(21,22,21,25): error CS8157: No 'operator is' declaration in 'B' was found with 0 out parameters\r\nProgram.cs(20,35,20,40): error CS0428: Cannot convert method group 'Prop2' to non-delegate type 'int'. Did you intend to invoke the method?\r\n```"},"comment":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/comments/206359166","html_url":"https://github.com/dotnet/roslyn/issues/10364#issuecomment-206359166","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/10364","id":206359166,"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},"created_at":"2016-04-06T13:00:37Z","updated_at":"2016-04-06T13:00:37Z","body":"@gafter, \"Pattern matching `is` operator doesn't function correctly across assemblies\" issue created as requested."}}