bugKawa - Bugs: bug #39209, failing member lookup from...

 
 

bug #39209: failing member lookup from inherited not-yet-compiled class

Submitter:  Per Bothner <bothner>
Submitted:  Sat 08 Jun 2013 11:26:31 PM UTC
   
 
Category:  Scheme language Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Confirmed Privacy:  Public
Assigned to:  bothner Open/Closed:  Open
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

Sat 08 Jun 2013 11:26:31 PM UTC, original submission:  

Consider:

(define-simple-class Base ()
  ((foo) ::java.lang.String #!abstract)
  ((bar x)
   (if x (foo) "ab")))

(define (create-simple) ::Base
  (object (Base)
    ((foo)
     (bar #f))))

(let ((simple ::Base (create-simple)))
  (format #t "~a~%" (invoke simple 'foo)))

Line-by line evaluation works:

$ kawa -f meth.scm
ab

Whole-module evaluation doesn't:

$ kawa meth.scm
/home/bothner/tmp/meth.scm:9:6: warning - no declaration seen for bar
/home/bothner/tmp/meth.scm:9:6: unbound location bar
        at gnu.mapping.SharedLocation.get(SharedLocation.java:22)
        at gnu.mapping.ThreadLocation.get(ThreadLocation.java:105)
        at meth$0.foo(meth.scm:9)
        at meth.run(meth.scm:12)
        at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:309)
        at gnu.expr.CompiledModule.evalModule(CompiledModule.java:41)
        at gnu.expr.CompiledModule.evalModule(CompiledModule.java:60)
        at kawa.Shell.runFile(Shell.java:497)
        at kawa.Shell.runFileOrClass(Shell.java:420)
        at kawa.repl.main(repl.java:874)

The problem is the name lookup in Translator#rewrite that searches for in-scope matching members.  It uses SlotGet#lookupMember.  However, this doesn't work on the class Base, because the members are created by ClassExp#declareParts, which doesn't been evaluated yet.

A solution is to search Base's ClassExp for a matching Declaration.  Another is to do (appropriate bits of) declareParts earlier.

Per Bothner <bothner>
Group administrator

 

Attached Files

This item currently has no attached files.

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

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

No items depend on this one.

 

Mail Notification Carbon-Copy List

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

    Votes

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    History

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.16.
    Corresponding source code