strangeness with _ methods returning bool - compile error
Posted: Wed Oct 29, 2008 11:44 pm
Heres something a bit strange
Seems to only occur with noarg _ named methods returning bool when called from inside the class without appending explicit '()'
(thats where I noticed it anyway).
The generated c# code for the failing line is missing an added '()' on the call to isFunny.
vs
- Code: Select all
class Funny
def _isFunny as bool
return true
def z
# below gives C# compile error: ... (9) error:Cannot convert method group "_isFunny" to non-delegate type "bool". Did you intend to invoke the method? (C#)
if _isFunny
#if _isFunny() # if done like this compiles OK
print 'OK'
def main is shared
x=Funny()
if x._isFunny # this is OK
print 'isFunny'
Seems to only occur with noarg _ named methods returning bool when called from inside the class without appending explicit '()'
(thats where I noticed it anyway).
The generated c# code for the failing line is missing an added '()' on the call to isFunny.
- Code: Select all
#line 9
if (_isFunny) {
#line 11
CobraImp.PrintLine(CobraImp._printStringMaker.MakeString("OK"));
#line 11
}
#line 11
vs
- Code: Select all
#line 15
if (x._isFunny()) {
#line 16
CobraImp.PrintLine(CobraImp._printStringMaker.MakeString("isFunny"));
#line 16
}