Opened 6 years ago
Closed 6 years ago
#1649 closed defect (fixed)
foreign-lambda annotates return type without considering retconvert from define-foreign-type
| Reported by: | megane | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 5.2 |
| Component: | scrutinizer | Version: | 5.1.0 |
| Keywords: | Cc: | ||
| Estimated difficulty: | medium |
Description
(module
m
*
(import scheme
(chicken base)
(chicken string)
(chicken type)
(chicken foreign))
(define-foreign-type foo int identity ->string)
;; inch gets annotated with type (procedure () fixnum) when the
;; return type should be whatever the retconvert argument to
;; define-foreign-type returns (string in this case)
(define inch (foreign-lambda foo "rand"))
(let ((v (inch)))
(compiler-typecase v (fixnum (print (add1 (the * v)))))))
=>
;; Error: (+) bad argument type - not a number: "92475436"
;;
;; Call history:
;;
;; ncurses.scm:3: ##sys#with-environment
;; ncurses.scm:3: ##sys#register-compiled-module
;; ncurses.scm:15: g14 <--
Note: See
TracTickets for help on using
tickets.

Fixed by d6359ebf. We could be smarter about determining the right types, but the incorrect type is no longer used.