bug-kawa
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-kawa] [bug #39209] failing member lookup from inherited not-yet-com


From: Per Bothner
Subject: [Bug-kawa] [bug #39209] failing member lookup from inherited not-yet-compiled class
Date: Sat, 08 Jun 2013 23:26:32 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:21.0) Gecko/20100101 Firefox/21.0

URL:
  <http://savannah.gnu.org/bugs/?39209>

                 Summary: failing member lookup from inherited
not-yet-compiled class
                 Project: Kawa
            Submitted by: bothner
            Submitted on: Sat 08 Jun 2013 11:26:31 PM GMT
                Category: Scheme language
                Severity: 3 - Normal
              Item Group: None
                  Status: Confirmed
                 Privacy: Public
             Assigned to: bothner
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

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.





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?39209>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]