bugKawa - Bugs: bug #36973, poor overload resolution when...


bug #36973: poor overload resolution when boxing numerics

Submitted by:  Per Bothner <bothner>
Submitted on:  Fri 27 Jul 2012 06:19:15 AM UTC  
Category:  Type declaration and inference Severity:  3 - Normal
Item Group:  Bad diagnostic Status:  Confirmed
Privacy:  Public Assigned to:  Per Bothner <bothner>
Open/Closed:  Open

Add a New Comment(Rich Markup)

You are not logged in

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


Tue 16 Dec 2014 12:29:04 AM UTC, comment #2:

Thanks for the patch and testcase. I cehcked both in - the testcase became testsuite/overload2.scm.

Unfortunately, the original issue is a different issue/bug than your issue (as you can see by that fact that your patch didn't affect it), so I'm going to have to leave it open. In general, when it doubt it is better to create a new issue - I can always resolve it as a duplicate.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Mon 15 Dec 2014 05:19:43 AM UTC, comment #1:

This issue cropped up with Android's org.json.JSONObject put method.

I could not create a test case only in Scheme, but managed to reduce the problem to a small Java and a small Scheme program. The fault seems to be that the String parameters do not compare as equal.

Attached are the test case (sva36973.scm and sva36973b.java) and a patch against kawa-2.0 that seems to work, but has not been thoroughly tested (stringtype.patch).

(file #32669, file #32670, file #32671)

Victor van den Elzen <victorvde>
Fri 27 Jul 2012 06:19:15 AM UTC, original submission:

(define-simple-class ContentValues ()
((put s::java.lang.String d::java.lang.Double) ::void #!void)
((put s::java.lang.String l::java.lang.Long) ::void #!void)
((put s::java.lang.String f::java.lang.Float) ::void #!void))

(define (foo cv::ContentValues s::java.lang.String l::long)
(cv:put s l))


tmp/a2.scm:7:3: warning - more than one definitely applicable method `put' in ContentValues
candidate: void ContentValues.put(java.lang.String,java.lang.Float)
candidate: void ContentValues.put(java.lang.String,java.lang.Long)
candidate: void ContentValues.put(java.lang.String,java.lang.Double)

It should choose put(java.lang.String,java.lang.Long).

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 Files:

Attached Files
file #32669:  sva36973.scm added by victorvde (392B - application/octet-stream)
file #32670:  sva36973b.java added by victorvde (208B - application/octet-stream)
file #32671:  stringtype.patch added by victorvde (652B - text/x-c)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by victorvde (Updated the item)
  • -email is unavailable- added by bothner (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.


    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
    Mon 15 Dec 2014 05:19:43 AM UTC victorvde Attached File- => Added sva36973.scm, #32669
        Attached File- => Added sva36973b.java, #32670
        Attached File- => Added stringtype.patch, #32671

    Back to the top

    Powered by Savane 3.3