Page 1 of 1

Cobra Internal Error

PostPosted: Wed Mar 16, 2011 7:57 pm
by torial
When I incorrectly use an Enum ,

textBox.anchor = textBox.anchor or AnchorStyles.Right


I get the following Internal Error:

error: COBRA INTERNAL ERROR / FallThroughException / info=TruthExpr-sh(75266, didBindInh=false, didBindInt=false, didStartBindImp=true, didBindImp=false, token=Token(DOT, '.', '.', ln 52, col 33, C:\Users\seanm\Desktop\Cobra\IDE\Utils.cobra), Treatment=AsIs, type=nil, 75266)


A better messages would be anything from a generic "syntax error at line 52", to "incorrect enum operation, try |" or something like that. Should I write a bug up?

Re: Cobra Internal Error

PostPosted: Wed Mar 16, 2011 10:55 pm
by Charles
Looks like we have it in ticket:265 although a different bit of code produced it. Of course, if we fixed the use of enums as truth values to just work then your OR expression becomes valid even though it's clearly not what you intended.

I've added this discussion to the ticket.

Re: Cobra Internal Error

PostPosted: Sun Sep 23, 2012 5:02 pm
by Charles
This will now give the error message:

Cannot treat enums as truth values. Compare them to a value with "==" or "<>", or if they are flags, use a bitwise operator ("&", "|", "~").