{"action":"created","issue":{"url":"https://api.github.com/repos/bridgedotnet/Bridge/issues/3550","repository_url":"https://api.github.com/repos/bridgedotnet/Bridge","labels_url":"https://api.github.com/repos/bridgedotnet/Bridge/issues/3550/labels{/name}","comments_url":"https://api.github.com/repos/bridgedotnet/Bridge/issues/3550/comments","events_url":"https://api.github.com/repos/bridgedotnet/Bridge/issues/3550/events","html_url":"https://github.com/bridgedotnet/Bridge/issues/3550","id":320307808,"number":3550,"title":"Compiler crash in Bridge 17 Beta","user":{"login":"Cu3PO42","id":5256300,"avatar_url":"https://avatars1.githubusercontent.com/u/5256300?v=4","gravatar_id":"","url":"https://api.github.com/users/Cu3PO42","html_url":"https://github.com/Cu3PO42","followers_url":"https://api.github.com/users/Cu3PO42/followers","following_url":"https://api.github.com/users/Cu3PO42/following{/other_user}","gists_url":"https://api.github.com/users/Cu3PO42/gists{/gist_id}","starred_url":"https://api.github.com/users/Cu3PO42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cu3PO42/subscriptions","organizations_url":"https://api.github.com/users/Cu3PO42/orgs","repos_url":"https://api.github.com/users/Cu3PO42/repos","events_url":"https://api.github.com/users/Cu3PO42/events{/privacy}","received_events_url":"https://api.github.com/users/Cu3PO42/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2018-05-04T14:58:21Z","updated_at":"2018-05-07T20:15:42Z","closed_at":null,"author_association":"NONE","body":"I'm currently trying to get an existing code base to compile with Bridge.  \r\nI'm running macOS and using the latest commit of Bridge CLI to invoke the compiler and Mono v5.10.1.47 in case that might be relevant.\r\n\r\nAfter fixing a large amount of compile errors in the project, I am now experiencing a compiler crash.\r\nI have not been able to get a minimal reproduction working, so I have uploaded [the entire code base](https://github.com/Cu3PO42/PKHeX-Bridge/tree/bridge-issue).\r\n\r\nUnfortunately I cannot try a non-beta release of Bridge, as the code makes use of C#7 features.\r\n\r\nThe error message is:\r\n```\r\nBuilding PKHeX-Bridge        Bridge.NET Compiler error: exception level: 0 - One or more errors occurred.\r\nStack trace:\r\n  at System.Threading.Tasks.Task.WaitAll (System.Threading.Tasks.Task[] tasks, System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x001d1] in <bb7b695b8c6246b3ac1646577aea7650>:0\r\n  at System.Threading.Tasks.Task.WaitAll (System.Threading.Tasks.Task[] tasks, System.Int32 millisecondsTimeout) [0x00000] in <bb7b695b8c6246b3ac1646577aea7650>:0\r\n  at System.Threading.Tasks.Task.WaitAll (System.Threading.Tasks.Task[] tasks) [0x00000] in <bb7b695b8c6246b3ac1646577aea7650>:0\r\n  at Bridge.Translator.Translator.Rewrite () [0x00045] in <16b02f793b284c3c855cea5dc8b9ff4d>:0\r\n  at Bridge.Translator.Translator.BuildSyntaxTree () [0x0001d] in <16b02f793b284c3c855cea5dc8b9ff4d>:0\r\n  at Bridge.Translator.Translator.Translate () [0x00184] in <16b02f793b284c3c855cea5dc8b9ff4d>:0\r\n  at Bridge.Translator.TranslatorProcessor.Process () [0x00006] in <16b02f793b284c3c855cea5dc8b9ff4d>:0\r\n  at (wrapper dynamic-method) System.Object.CallSite.Target(System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,object)\r\n  at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid1[T0] (System.Runtime.CompilerServices.CallSite site, T0 arg0) [0x000fa] in <b29fa38c592649ee8d566c045a7d9307>:0\r\n  at Bridge.CLI.Program.Main (System.String[] args) [0x00658] in <c6cb803dee974b7a8705e52da8970f6e>:0\r\nBridge.NET Compiler error: exception level: 1 - Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index\r\nStack trace:\r\n  at System.ThrowHelper.ThrowArgumentOutOfRange_IndexException () [0x0000c] in <bb7b695b8c6246b3ac1646577aea7650>:0\r\n  at Bridge.Translator.SwitchPatternReplacer.CollectCondition (Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expressionSyntax, Microsoft.CodeAnalysis.SyntaxList`1[TNode] labels, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax keyType) [0x002f9] in <16b02f793b284c3c855cea5dc8b9ff4d>:0\r\n  at Bridge.Translator.SwitchPatternReplacer+<>c__DisplayClass0_0.<Replace>b__1 (Microsoft.CodeAnalysis.CSharp.Syntax.SwitchStatementSyntax s1, Microsoft.CodeAnalysis.CSharp.Syntax.SwitchStatementSyntax sw) [0x0016a] in <16b02f793b284c3c855cea5dc8b9ff4d>:0\r\n  at Microsoft.CodeAnalysis.CSharp.Syntax.SyntaxReplacer+Replacer`1[TNode].Visit (Microsoft.CodeAnalysis.SyntaxNode node) [0x00031] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitListElement[TNode] (TNode node) [0x00000] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitList[TNode] (Microsoft.CodeAnalysis.SyntaxList`1[TNode] list) [0x00017] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitBlock (Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax node) [0x00014] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax.Accept[TResult] (Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor`1[TResult] visitor) [0x00000] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.Visit (Microsoft.CodeAnalysis.SyntaxNode node) [0x0001c] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.Syntax.SyntaxReplacer+Replacer`1[TNode].Visit (Microsoft.CodeAnalysis.SyntaxNode node) [0x00013] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitMethodDeclaration (Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax node) [0x00087] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax.Accept[TResult] (Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor`1[TResult] visitor) [0x00000] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.Visit (Microsoft.CodeAnalysis.SyntaxNode node) [0x0001c] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.Syntax.SyntaxReplacer+Replacer`1[TNode].Visit (Microsoft.CodeAnalysis.SyntaxNode node) [0x00013] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitListElement[TNode] (TNode node) [0x00000] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitList[TNode] (Microsoft.CodeAnalysis.SyntaxList`1[TNode] list) [0x00017] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitClassDeclaration (Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax node)[0x0007d] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax.Accept[TResult] (Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor`1[TResult] visitor) [0x00000] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.Visit (Microsoft.CodeAnalysis.SyntaxNode node) [0x0001c] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.Syntax.SyntaxReplacer+Replacer`1[TNode].Visit (Microsoft.CodeAnalysis.SyntaxNode node) [0x00013] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitListElement[TNode] (TNode node) [0x00000] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitList[TNode] (Microsoft.CodeAnalysis.SyntaxList`1[TNode] list) [0x00017] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitNamespaceDeclaration (Microsoft.CodeAnalysis.CSharp.Syntax.NamespaceDeclarationSyntax node) [0x0004e] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.Syntax.NamespaceDeclarationSyntax.Accept[TResult] (Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor`1[TResult] visitor) [0x00000] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.Visit (Microsoft.CodeAnalysis.SyntaxNode node) [0x0001c] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.Syntax.SyntaxReplacer+Replacer`1[TNode].Visit (Microsoft.CodeAnalysis.SyntaxNode node) [0x00013] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitListElement[TNode] (TNode node) [0x00000] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitList[TNode] (Microsoft.CodeAnalysis.SyntaxList`1[TNode] list) [0x00017] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitCompilationUnit (Microsoft.CodeAnalysis.CSharp.Syntax.CompilationUnitSyntax node) [0x0002e] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.Syntax.CompilationUnitSyntax.Accept[TResult] (Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor`1[TResult] visitor) [0x00000] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.Visit (Microsoft.CodeAnalysis.SyntaxNode node) [0x0001c] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.Syntax.SyntaxReplacer+Replacer`1[TNode].Visit (Microsoft.CodeAnalysis.SyntaxNode node) [0x00013] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.Syntax.SyntaxReplacer.Replace[TNode] (Microsoft.CodeAnalysis.SyntaxNode root, System.Collections.Generic.IEnumerable`1[T] nodes, System.Func`3[T1,T2,TResult] computeReplacementNode, System.Collections.Generic.IEnumerable`1[T] tokens, System.Func`3[T1,T2,TResult] computeReplacementToken, System.Collections.Generic.IEnumerable`1[T] trivia, System.Func`3[T1,T2,TResult] computeReplacementTrivia) [0x00017] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode.ReplaceCore[TNode] (System.Collections.Generic.IEnumerable`1[T] nodes, System.Func`3[T1,T2,TResult] computeReplacementNode, System.Collections.Generic.IEnumerable`1[T] tokens, System.Func`3[T1,T2,TResult] computeReplacementToken, System.Collections.Generic.IEnumerable`1[T] trivia, System.Func`3[T1,T2,TResult] computeReplacementTrivia) [0x00000] in <c6ef24de369344debe17154b164bb0c5>:0\r\n  at Microsoft.CodeAnalysis.SyntaxNodeExtensions.ReplaceNodes[TRoot,TNode] (TRoot root, System.Collections.Generic.IEnumerable`1[T] nodes, System.Func`3[T1,T2,TResult] computeReplacementNode) [0x00000] in <b9e42f0a228d408b97a82c491aad03ba>:0\r\n  at Bridge.Translator.SwitchPatternReplacer.Replace (Microsoft.CodeAnalysis.SyntaxNode root, Microsoft.CodeAnalysis.SemanticModel model) [0x0004d] in <16b02f793b284c3c855cea5dc8b9ff4d>:0\r\n  at Bridge.Translator.SharpSixRewriter.Rewrite (System.Int32 index) [0x0016c] in <16b02f793b284c3c855cea5dc8b9ff4d>:0\r\n  at Bridge.Translator.Translator+<>c__DisplayClass91_1.<Rewrite>b__1 () [0x00021] in <16b02f793b284c3c855cea5dc8b9ff4d>:0\r\n  at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in <bb7b695b8c6246b3ac1646577aea7650>:0\r\n  at System.Threading.Tasks.Task.Execute () [0x00010] in <bb7b695b8c6246b3ac1646577aea7650>:0\r\n``` \r\n\r\n### Steps to reproduce\r\n\r\n1. Install latest commit of Bridge CLI.\r\n2. Clone [this](https://github.com/Cu3PO42/PKHeX-Bridge.git).\r\n3. Checkout `bridge-issue`.\r\n4. Run `bridge build`."},"comment":{"url":"https://api.github.com/repos/bridgedotnet/Bridge/issues/comments/387190614","html_url":"https://github.com/bridgedotnet/Bridge/issues/3550#issuecomment-387190614","issue_url":"https://api.github.com/repos/bridgedotnet/Bridge/issues/3550","id":387190614,"user":{"login":"geoffreymcgill","id":62210,"avatar_url":"https://avatars1.githubusercontent.com/u/62210?v=4","gravatar_id":"","url":"https://api.github.com/users/geoffreymcgill","html_url":"https://github.com/geoffreymcgill","followers_url":"https://api.github.com/users/geoffreymcgill/followers","following_url":"https://api.github.com/users/geoffreymcgill/following{/other_user}","gists_url":"https://api.github.com/users/geoffreymcgill/gists{/gist_id}","starred_url":"https://api.github.com/users/geoffreymcgill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geoffreymcgill/subscriptions","organizations_url":"https://api.github.com/users/geoffreymcgill/orgs","repos_url":"https://api.github.com/users/geoffreymcgill/repos","events_url":"https://api.github.com/users/geoffreymcgill/events{/privacy}","received_events_url":"https://api.github.com/users/geoffreymcgill/received_events","type":"User","site_admin":false},"created_at":"2018-05-07T20:15:42Z","updated_at":"2018-05-07T20:15:42Z","author_association":"OWNER","body":"We found a case where the `switch` statement is failing. Here's a sample to reproduce:\r\n\r\nhttps://deck.net/05d0d8fd1685dab3d65a3f1be31f8d67\r\n\r\n```csharp\r\npublic class Program\r\n{\r\n    public static void Main()\r\n    {\r\n        var species = 744;\r\n        var form = 1;\r\n        \r\n        switch (species)\r\n        {\r\n            case 744 when form == 1:\r\n            case 745 when form == 2:\r\n                Console.WriteLine(form);\r\n                break;\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nWe will be fixing this scenario right away. "}}
{"actor":{"display_login":"geoffreymcgill"}}