Forums

Incorrect method invocation doesn't get reported (cobra bug)

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

Incorrect method invocation doesn't get reported (cobra bug)

Postby Chasm » Fri Jun 21, 2013 11:29 pm

So, here I am again, this time with a very small program that nicely demonstrates the problem:

System: Win 7 x86-64
IDE: Xamarin
Cobra: Latest (0.9.4)

Code: Select all
class Program

   def main
      variable as int
      streamReader = StreamReader("Something.txt")
      streamReader.getType(variable,


As you can see, the getType invocation is incorrect, but the compiler completely fails to report any problem.
The only error I get is: 'Error: error: COBRA INTERNAL ERROR / NullReferenceException / Object reference not set to an instance of an object.
(Error2)
'

Do I post bugs and weirdness that I find here, or is there some bugzilla-like place you guys have?

Hope this helps
Chasm
 
Posts: 33

Re: Incorrect method invocation doesn't get reported (cobra

Postby hopscc » Sat Jun 22, 2013 2:13 am

Thx for that, small simple tests cases always help.

Theres a trac ticket report system at http://cobra-language.com/trac/cobra/report.
Choose a report and look at the tickets
You can add/edit/augment tickets if you login to the trac side of things ( use same login as the forum) which can be done off any of the trac pages.

Usually its 'better' to post a bug query/report/weirdness Question on the forum to see if theres any discussion/followup needed...
("thats not a bug its a feature - and heres why :) "
Once a clear issue and test case is available open a specific ticket and (perhaps) reference any forum discussion..
But whatever you find preferable...

If you hit something that generates a cobra compiler 'COBRA INTERNAL ERROR') just open a ticket - no discussion required (unless you want one)

I've got a fix for this specific situation.... I'll open a ticket and put a patch on it
hopscc
 
Posts: 632
Location: New Plymouth, Taranaki, New Zealand

Re: Incorrect method invocation doesn't get reported (cobra

Postby Chasm » Sat Jun 22, 2013 4:44 am

Got it - Cobra Error -> Ticket, other things -> forum first.

You guys are doing a great job. :)
Chasm
 
Posts: 33

Re: Incorrect method invocation doesn't get reported (cobra

Postby hopscc » Sat Jun 22, 2013 8:01 am

Opinions vary :)

Bug logged on ticket:334
hopscc
 
Posts: 632
Location: New Plymouth, Taranaki, New Zealand

Re: Incorrect method invocation doesn't get reported (cobra

Postby hopscc » Sun Jun 23, 2013 4:30 am

patch on ticket.
hopscc
 
Posts: 632
Location: New Plymouth, Taranaki, New Zealand

Re: Incorrect method invocation doesn't get reported (cobra

Postby Charles » Sun Jun 23, 2013 12:25 pm

I think you forgot to upload the patch on that ticket.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Incorrect method invocation doesn't get reported (cobra

Postby hopscc » Sun Jun 23, 2013 11:57 pm

Oops :oops:
Darn those pesky kids.
Try again.
hopscc
 
Posts: 632
Location: New Plymouth, Taranaki, New Zealand

Re: Incorrect method invocation doesn't get reported (cobra

Postby Charles » Thu Jun 27, 2013 5:46 pm

Fixed.

I took a different approach than the patch; one that I hope will fix this across all situations. I made the following changes:

The tokenizer always produces an EOF at the end of the token stream. In fact, calling .nextToken will continue to produce EOF's and the method can no longer return nil.

Tokenizer.allTokens returns a finite list guaranteed to at least have an EOF token at the end.

There is an IToken.isEOF boolean property that can be queried.

Parser.peek and .grab can no longer return nil, but will instead return EOF. Consequently, there is no need to check for nil tokens (in fact, this will produce a warning that they can never be nil).

Those changes all lead to this:

As many of the token examinations in CobraParser are based on .which, it naturally falls out that a .which of "EOF" will not match what various parsing methods are looking for, causing them to skip to other parsing logic or to complain about what was expected.

It's a (minor) variation on the Null Object Pattern.
Charles
 
Posts: 2515
Location: Los Angeles, CA


Return to Discussion

Who is online

Users browsing this forum: No registered users and 24 guests

cron