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

 
 

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

Submitted by:  Per Bothner <bothner>
Submitted on:  Sat 08 Jun 2013 11:26:31 PM UTC  
 
Category: Scheme languageSeverity: 3 - Normal
Item Group: NoneStatus: Confirmed
Privacy: PublicAssigned to: Per Bothner <bothner>
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

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>
Project AdministratorIn charge of this item.

 

(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 (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):

     

     

    No Changes Have Been Made to This Item

    Back to the top


    Powered by Savane 3.1-cleanup