kjm00king / sharpkit

Automatically exported from code.google.com/p/sharpkit
0 stars 0 forks source link

Enum values are incorrect #275

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The values associated with each enum constant should be incrementing integers 
starting with 0 unless they are explicitly defined by the enum.

    public enum Alignments
    {
        Left,
        Right
    } 

should compile to

var Alignments =
{
    fullname: "Alignments",
    staticDefinition: {Left: 0, Right: 1},
    Kind: "Enum"
}; 

but actually compiles to 

var Alignments =
{
    fullname: "Alignments",
    staticDefinition: {Left: "Left", Right: "Right"},
    Kind: "Enum"
}; 

This is problematic because when compiling assignment the compiler uses the 
integer constants, so attempts at comparison result in (0 == "Left") == false.

I think this bug was introduced in 5.0.4000 or 5.0.3000, because it used to 
work.

See also issue 162 re: initialization.

Original issue reported on code.google.com by yvan.rod...@gmail.com on 31 Jan 2013 at 3:32

GoogleCodeExporter commented 8 years ago
Here is a sample project.

Original comment by yvan.rod...@gmail.com on 31 Jan 2013 at 5:26

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by DanelK...@gmail.com on 31 Jan 2013 at 6:06

GoogleCodeExporter commented 8 years ago
Fixed code generation when accessing non json mode enum members - disabling 
constant value inlining, and using the correct path to enum.

Original comment by DanelK...@gmail.com on 22 Feb 2013 at 7:58