Ticket #267 (new defect)
Cobra Enums not support methods of Enum Baseclass
Reported by: | hopscc | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | Cobra Compiler | Version: | 0.8.0 |
Keywords: | Cc: |
Description
The .Net Enum baseclass have a few none static methods and a plethora of static methods for obtaining member names and values and doing conversions.
Cobra Enums dont recognise these methods.
#access to Enum methods via cobra enum class EnumMethods enum Days Mon,Tues,Wed, Thurs, Fri, Sat, Sun enum States has Flags None=0, Invalid=1, Settling=2, Valid =4 def main is shared d = Days.Mon weekend = Days(Sat, Sun) inweekend = d in Set<of Days>([Days.Sat, Days.Sun]) print '[d] in weekendSet', inweekend #static print Enum.getName(Days, d) print Days.getName(Days, d) # shd work doesnt compile print Enum.getNames(Days) print weekend s = States() print Enum.getNames(States) print Enum.getValues(States) assert s inherits Enum print s.getNames(States) # shd work doesnt compile print s.getValues(States) # shd work doesnt compile print s.hasFlag(States.Invalid) # doesnt compile s = States.Settling s1 = s to Enum # spurious warning print s1.hasFlag(States.Invalid) # cant see hasFlag print s1.typeOf
Change History
Note: See
TracTickets for help on using
tickets.