Page 1 of 1

internal error when incorrectly casing member

PostPosted: Fri Dec 12, 2008 6:15 am
by gauthier
I get internal error when compiling this code

class WritingStuff
def doThat
tw = StringWriter()
tw.writeline #this is generating the error

class Test
def main is shared
w = WritingStuff()
w.doThat


By the way, is there a compiler trace feature that output each line number before an internal exception occurs or such functionality? I got this bug in a 500 line file and it would help to track down where the parsing choke.

Re: getting internal error

PostPosted: Fri Dec 12, 2008 6:29 am
by jonathandavid
Yes, there seems to be something rather wrong about StringBuilder.writeline.

The following fails too (and produces the longest error message I've ever seen):

class Test
def main is shared
StringWriter().writeline('')


Interestingly, this works:

class Test
def main is shared
StringWriter().write('')

Re: getting internal error

PostPosted: Fri Dec 12, 2008 7:07 am
by gauthier
that's all it takes to catch typo, the actual method name is WriteLine so it should called writeLine!

Re: getting internal error

PostPosted: Fri Dec 12, 2008 9:44 am
by jonathandavid
That's weird, I would've expected a more "friendly" error from the cobra compiler for such a simple error (misspelling a method's name)

So it looks like I was of help even if that wasn't my intention :lol:

Re: getting internal error

PostPosted: Fri Dec 12, 2008 10:58 am
by Charles
I'll take a look later today. Have to bust out the rent right now...

Re: getting internal error

PostPosted: Sat Dec 13, 2008 12:26 am
by Charles
Fixed in changeset:1824.

-- The internal error messages are now truncated to 1024 chars.

-- This bug happened if you (1) spelled the member name correctly, (2) got the case wrong and (3) it was a member overload.

-- Regarding the line number, we have this for internal errors in the parser but not for the subsequent phases of the compiler.

Re: internal error when incorrectly casing member

PostPosted: Sat Dec 13, 2008 4:42 am
by jonathandavid
Chuck wrote:This bug happened if you (1) spelled the member name correctly, (2) got the case wrong and (3) it was a member overload.


Wow, that was some ace bug finding on gauthier's part :lol: