-
Notifications
You must be signed in to change notification settings - Fork 202
Closed
Description
When I use this minimal test case to reproduce the issue:
using System.Collections.Generic;
namespace Test
{
public enum Test {
a,
b
}
public class TestClass {
public Dictionary<Test, bool> test = new Dictionary<Test, bool>() {
{Test.a, true},
{Test.b, false}
};
}
}
I get this as the output when trying to build:
Assertion failed.
Description: Assertion failed.
Stack Trace:
at CSharpLua.LuaSyntaxNodeTransfor.VisitInitializerExpression(InitializerExpressionSyntax node) in F:\Misc\code\CSharp.lua\CSharp.lua\LuaSyntaxNodeTransfor.Object.cs:line 142
at CSharpLua.LuaSyntaxNodeTransfor.BuildObjectInitializerExpression(InitializerExpressionSyntax node) in F:\Misc\code\CSharp.lua\CSharp.lua\LuaSyntaxNodeTransfor.Object.cs:line 112
at CSharpLua.LuaSyntaxNodeTransfor.VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) in F:\Misc\code\CSharp.lua\CSharp.lua\LuaSyntaxNodeTransfor.Object.cs:line 80
at CSharpLua.LuaSyntaxNodeTransfor.GetFieldValueExpression(TypeSyntax type, ITypeSymbol typeSymbol, ExpressionSyntax expression, Boolean& valueIsLiteral) in F:\Misc\code\CSharp.lua\CSharp.lua\LuaSyntaxNodeTransfor.cs:line 636
at CSharpLua.LuaSyntaxNodeTransfor.AddField(LuaIdentifierNameSyntax name, ITypeSymbol typeSymbol, TypeSyntax type, ExpressionSyntax expression, Boolean isImmutable, Boolean isStatic, Boolean isPrivate, Boolean isReadOnly, SyntaxList`1 attributeLists) in F:\Misc\code\CSharp.lua\CSharp.lua\LuaSyntaxNodeTransfor.cs:line 659
at CSharpLua.LuaSyntaxNodeTransfor.VisitBaseFieldDeclarationSyntax(BaseFieldDeclarationSyntax node) in F:\Misc\code\CSharp.lua\CSharp.lua\LuaSyntaxNodeTransfor.cs:line 608
at CSharpLua.LuaSyntaxNodeTransfor.VisitFieldDeclaration(FieldDeclarationSyntax node) in F:\Misc\code\CSharp.lua\CSharp.lua\LuaSyntaxNodeTransfor.cs:line 628
at Microsoft.CodeAnalysis.CSharp.Syntax.FieldDeclarationSyntax.Accept[TResult](CSharpSyntaxVisitor`1 visitor)
at CSharpLua.LuaSyntaxNodeTransfor.BuildTypeMembers(LuaTypeDeclarationSyntax typeDeclaration, TypeDeclarationSyntax node) in F:\Misc\code\CSharp.lua\CSharp.lua\LuaSyntaxNodeTransfor.cs:line 175
at CSharpLua.LuaSyntaxNodeTransfor.BuildTypeDeclaration(INamedTypeSymbol typeSymbol, TypeDeclarationSyntax node, LuaTypeDeclarationSyntax typeDeclaration) in F:\Misc\code\CSharp.lua\CSharp.lua\LuaSyntaxNodeTransfor.cs:line 239
at CSharpLua.LuaSyntaxNodeTransfor.VisitTypeDeclaration(INamedTypeSymbol typeSymbol, TypeDeclarationSyntax node, LuaTypeDeclarationSyntax typeDeclaration) in F:\Misc\code\CSharp.lua\CSharp.lua\LuaSyntaxNodeTransfor.cs:line 286
at CSharpLua.LuaSyntaxNodeTransfor.VisitClassDeclaration(ClassDeclarationSyntax node) in F:\Misc\code\CSharp.lua\CSharp.lua\LuaSyntaxNodeTransfor.cs:line 367
at Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax.Accept[TResult](CSharpSyntaxVisitor`1 visitor)
at CSharpLua.LuaSyntaxNodeTransfor.BlockCommonNode.Visit(LuaSyntaxNodeTransfor transfor) in F:\Misc\code\CSharp.lua\CSharp.lua\LuaSyntaxNodeTransfor.cs:line 922
at CSharpLua.LuaSyntaxNodeTransfor.<VisitTriviaAndNode>d__71.MoveNext() in F:\Misc\code\CSharp.lua\CSharp.lua\LuaSyntaxNodeTransfor.cs:line 977
at System.Linq.Enumerable.<CastIterator>d__34`1.MoveNext()
at CSharpLua.LuaAst.LuaSyntaxList`1.AddRange(IEnumerable`1 collection) in F:\Misc\code\CSharp.lua\CSharp.lua\LuaAst\LuaSyntaxNode.cs:line 158
at CSharpLua.LuaAst.LuaWrapFunctionStatementSynatx.AddStatements(IEnumerable`1 statements) in F:\Misc\code\CSharp.lua\CSharp.lua\LuaAst\LuaWrapFunctionStatementSynatx.cs:line 50
at CSharpLua.LuaSyntaxNodeTransfor.VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) in F:\Misc\code\CSharp.lua\CSharp.lua\LuaSyntaxNodeTransfor.cs:line 168
at Microsoft.CodeAnalysis.CSharp.Syntax.NamespaceDeclarationSyntax.Accept[TResult](CSharpSyntaxVisitor`1 visitor)
at CSharpLua.LuaSyntaxNodeTransfor.BlockCommonNode.Visit(LuaSyntaxNodeTransfor transfor) in F:\Misc\code\CSharp.lua\CSharp.lua\LuaSyntaxNodeTransfor.cs:line 922
at CSharpLua.LuaSyntaxNodeTransfor.<VisitTriviaAndNode>d__71.MoveNext() in F:\Misc\code\CSharp.lua\CSharp.lua\LuaSyntaxNodeTransfor.cs:line 977
at CSharpLua.LuaSyntaxNodeTransfor.VisitCompilationUnit(CompilationUnitSyntax node) in F:\Misc\code\CSharp.lua\CSharp.lua\LuaSyntaxNodeTransfor.cs:line 148
at Microsoft.CodeAnalysis.CSharp.Syntax.CompilationUnitSyntax.Accept[TResult](CSharpSyntaxVisitor`1 visitor)
at CSharpLua.LuaSyntaxGenerator.Create() in F:\Misc\code\CSharp.lua\CSharp.lua\LuaSyntaxGenerator.cs:line 120
at CSharpLua.LuaSyntaxGenerator.Generate(String outFolder) in F:\Misc\code\CSharp.lua\CSharp.lua\LuaSyntaxGenerator.cs:line 138
at CSharpLua.Worker.Compiler() in F:\Misc\code\CSharp.lua\CSharp.lua\Worker.cs:line 126
at CSharpLua.Worker.Do() in F:\Misc\code\CSharp.lua\CSharp.lua\Worker.cs:line 111
at CSharpLua.Program.Main(String[] args) in F:\Misc\code\CSharp.lua\CSharp.lua\Program.cs:line 64
Any potential fixes/workarounds? For now, I'm thinking of just using the int values of the enum values as keys, but I'm wondering if there's a better solution.
Edit: Just tested that, it didn't work.
Metadata
Metadata
Assignees
Labels
No labels