Page 1 of 1

Overloaded method compile bug?

PostPosted: Tue Aug 14, 2012 9:48 pm
by DelphiGuy
Compiling the following code, in a file named ESutils.cobra , on a Win 7 notebook resulted in the lengthy error msg posted below. Yes, I realize the code is goofy and makes no common sense, and that the method arguments are never used, but that's because I had to hack repeatedly at the original code in order to get it small enough to intelligently post here, while still replicating the error.

Code: Select all
namespace ESutils_

   class Program

      def main
         print 'hello'

   
   class MyRandom inherits Random
   
      cue init
         base.init
         
      enum Coin
         heads, tails
         
      def next(lowValue as int, highValue as int) as int    #fix next from random class,
         assert lowValue <= highValue
         assert highValue + 1 <= int.maxValue
         return base.next(lowValue, highValue + 1)
         
      def next(lowPitchName as Coin, highPitchName as Coin) as int     #fix next from random class,
         lowValue = 1   #lowPitchName to int
         highValue = 2 #highPitchName to int
         assert lowValue <= highValue
         assert highValue + 1 <= int.maxValue
         return base.next(lowValue, highValue + 1)


error msg:

C:\Users\Paul\Desktop\foldername>cobra esutils
error: COBRA INTERNAL ERROR / FallThroughException / info=MemberOverload-sh(9422, name=next, didBindInh=false, didStartBindInt=true, didBindInt=true,
didBindImp=false, token=Token.empty, name=next, isNames=['public'], numMembers=3, parentBox=Class-mi(1525, name=Random, didStartBindInh=true, didBindI
nh=true, didStartBindInt=true, didBindInt=true, didBindImp=false, token=Token.empty, didBindInh=true, isGeneric=false, isGenericDef=false, needsConstr
uction=false, 1525), 9422)
Compilation failed - 1 error, 0 warnings
Not running due to errors above.


Any comments? If the fault is mine and I'm missing something obvious in my code causing the error, I can't spot it.

Re: Overloaded method compile bug?

PostPosted: Tue Aug 14, 2012 11:30 pm
by Charles
The fault can never be yours when Cobra spits out "INTERNAL ERROR" in screaming caps. I'll take a look.

Btw including your output for "cobra -version" is always helpful.

Re: Overloaded method compile bug?

PostPosted: Wed Aug 15, 2012 1:20 am
by DelphiGuy
C:\Users\Paul\Desktop\foldername>cobra esutils
error: COBRA INTERNAL ERROR / FallThroughException / info=MemberOverload-sh(9923, name=next, didBindInh=false, didStartBindInt=true, didBindInt=true,
didBindImp=false, token=Token.empty, name=next, isNames=['public'], numMembers=3, parentBox=Class-mi(1525, name=Random, didStartBindInh=true, didBindI
nh=true, didStartBindInt=true, didBindInt=true, didBindImp=false, token=Token.empty, didBindInh=true, isGeneric=false, isGenericDef=false, needsConstr
uction=false, 1525), 9923)
Compilation failed - 1 error, 0 warnings
Not running due to errors above.

C:\Users\Paul\Desktop\foldername>cobra -version
Cobra svn: (post 0.8) / 2012-08-15 on .NET CLR v4.0.30319 on Microsoft Windows NT 6.1.7601 Service Pack 1

Re: Overloaded method compile bug?

PostPosted: Wed Aug 15, 2012 2:08 am
by hopscc
Hey chuck,

Since
(a)we/you always want the version when theres an Internal compiler error thrown and
(b)noone thinks to give it until
(c) you prompt for it

Why not modify the compiler to
insert the current version number into the output
when an internal error is either thrown or displayed ......

Might save some repetition ....

Re: Overloaded method compile bug?

PostPosted: Wed Aug 15, 2012 8:09 am
by Charles
That's a nice idea. Though many bug reports don't involve internal errors so I'd still like people to get "cobra -version" into their head.

Re: Overloaded method compile bug?

PostPosted: Fri Aug 17, 2012 7:48 am
by Charles
This is fixed now along with a test case so that we never see it again.

Re: Overloaded method compile bug?

PostPosted: Fri Aug 17, 2012 3:03 pm
by DelphiGuy
Thank you, Charles. I've now tested it and it seems flawless so far.