bugKawa - Bugs: bug #31355, warn-access-unknown-field

 
 

bug #31355: warn-access-unknown-field

Submitted by:  Helmut Eller <ellerh>
Submitted on:  Sun 17 Oct 2010 07:03:52 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: Feature RequestStatus: Fixed
Privacy: PublicAssigned to: Per Bothner <bothner>
Open/Closed: Closed

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 26 Oct 2010 06:38:17 AM UTC, comment #4:

"I think an full error is a too much in this case."
Note that it was an error in the "normal" case, even before my fix. But you may be right.

I agree that taking instance? and similar tests into account when checking for type errors would be highly desirable - some Scheme type-checkers do this. I think this makes sense as part of SSA analysis, which is one my wish-list.

For Kawa 1.11 I'm leaning towards adding a --warn-unknown-member option, and make missing field warning/errors be triggered by that warning.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Thu 21 Oct 2010 09:33:06 AM UTC, comment #3:

I think an full error is a too much in this case.
If the probability for false positives is small
enough than it would be good to warn about it by default.
But I think the probability is quite high.
Consider code like:
Kawa only warns when accessing l. It could also warn on p because the
gnu.lists.Pair class has no public field car (only a getCar method).
Under a more liberal interpretation both warnings are false positives,
because the type test guarantees that the getCar method will be found
at runtime.

I think it shouldn't even be a full warning only
an efficiency note.

Helmut Eller <ellerh>
Thu 21 Oct 2010 06:13:55 AM UTC, comment #2:

The problem was that <list> is a special kind of type - a LangObjType rather than a regular ClassType, and the code didn't handle LangObjType as it should. I checked in a fix for this.
We now get:
/tmp/sl.scm:2:3: no slot `car' in list

Which catches an error - the specification should be <pair>, not <list>.

It would probably make sense to have this be controlled by an option, perhaps --warn-unknown-member. Probably the default should be on. Should it be an error by default? This shoudl be re-considered, next release.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Sun 17 Oct 2010 07:07:33 AM UTC, comment #1:

With corrected markup:

For code like this

Kawa falls back to reflection but doesn't warn about it
even when compiled with --warn-invoke-unknown-method.
It would be nice if it did.

Helmut Eller <ellerh>
Sun 17 Oct 2010 07:03:52 AM UTC, original submission:

For code like this

Helmut Eller <ellerh>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bothner (Posted a comment)
  • -unavailable- added by ellerh (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 19 Jul 2013 12:45:15 AM UTCbothnerOpen/ClosedOpen=>Closed
    Thu 21 Oct 2010 06:13:55 AM UTCbothnerStatusNone=>Fixed
      Assigned toNone=>bothner

    Back to the top


    Powered by Savane 3.1-cleanup