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:  None Severity:  3 - Normal
Item Group:  Feature Request Status:  Fixed
Privacy:  Public Assigned to:  Per Bothner <bothner>
Open/Closed:  Closed

Add a New Comment(Rich 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 Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


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

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

    Only logged-in users can vote.




    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-07-19 bothner Open/ClosedOpen => Closed
    2010-10-21 bothner StatusNone => Fixed
        Assigned toNone => bothner

    Back to the top

    Powered by Savane 3.3