overload1.scm 1.0 KB

1234567891011121314151617181920212223242526
  1. ;; Savannah bug #38890: Wrong more than one applicable method warning
  2. (define (combine-sets (set-i :: <java.util.Set>) (set-j :: <java.util.Set>))
  3. (if (invoke set-i 'addAll set-j)
  4. (format (current-output-port) "All good.~%")))
  5. (define hs1 (java.util.TreeSet [5 7 6]))
  6. (combine-sets hs1 (java.util.HashSet [20 19]))
  7. ;; Output: All good.
  8. (format (current-output-port) "hs1: ~d~%" hs1)
  9. ;; Output: hs1: [5, 6, 7, 19, 20]
  10. ;; Savannah bug #38891: Wrong warning with literal double value
  11. (define (test-d)
  12. (make <java.lang.Double> 3.0))
  13. (format #t "three: ~s~%" (test-d))
  14. ;; Output: three: 3.0
  15. ;; Savannah bug #39047: Wrong incompatible type (boolean) with expected int
  16. (define-simple-class <Simple> (<Object>)
  17. ((create (value :: <int>))
  18. (format #t "Calling create int version with value[~a]~%" value))
  19. ((create (value :: <boolean>))
  20. (format #t "Calling create bool version with value[~a]~%" value)))
  21. (let ((simple :: <Simple> (make <Simple>)))
  22. (invoke simple 'create #t))
  23. ;; Output: Calling create bool version with value[#t]