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

 
 

bug #36973: poor overload resolution when boxing numerics

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

Post a Comment

Add a New Comment Rich Markup
   

Discussion

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>
Group administrator
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))

reports:

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>
Group administrator

 

Attached 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)

(Note: upload size limit is set to 4.0MiB, 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 victorvde (Updated the item)
  • -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

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-12-15 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.16-8b18.
    Corresponding source code