id summary reporter owner description type status priority milestone component version resolution keywords cc 377 Erroneous incompatible types when casting to enum Jonno "It's very possible that I'm missing something obvious here, but I am getting an error on what appears to be a safe down-cast from {{{Object?}}} to (a subclass of) {{{Enum?}}}. The specific method is {{{Enum.parse}}}, which is throwing the following error: {{{ Incompatible types. Cannot assign value of type Object? on the right to TestEnum? on the left. }}} Full example: {{{ enum TestEnum A, B, C class PossibleEnumCompileIssue def main is shared # This doesn't work/compile: # x as TestEnum? = Enum.parse(TestEnum, 'A') # This works, though: y as TestEnum Enum.tryParse('A', out y) # I believe the first line should be equivalent to this? sharp'global::TestEnum z = (global::TestEnum) System.Enum.Parse(typeof(global::TestEnum), ""A"")' }}} The compiler rejects the cast even if I check the type of x before casting." defect closed minor Cobra Compiler 0.9.6 invalid