rsdn / nemerle

Nemerle language. Main repository.
http://nemerle.org
Other
622 stars 89 forks source link

C# compiler doesn't support enum values as other enum's field initializer #567

Open Stitchous opened 11 years ago

Stitchous commented 11 years ago

this C# code

 public enum E1
 {
        Zero = 0
 }

 public enum E2
 {
        Zero = E1.Zero
  }

successfully compiles by csc, but produces following message in Nemerle project:

error : supplied value (0 :> E1) cannot be converted to int and isn't valid as enum field initializer

Stitchous commented 11 years ago

looks like Nemerle doesn't support this kind of enum fields initializators too

NN--- commented 11 years ago

If you look here: https://github.com/rsdn/nemerle/blob/master/ncc/hierarchy/TypeBuilder.n#L1900 Seems enum value is not counted as constant.

Stitchous commented 11 years ago

sometimes it is counted as constant and even as literal but with different type than current enum underlying type, so lit.WithType (underlying_enum_type) returns None