Summary
foreign-lambda annotates return type without considering retconvert from define-foreign-type
Metadata
- Id: 67b733fd037f76c1a9f257bf082b2a597fc69d37
- Trac id: 1649
- Type: defect
- Reporter: megane
- Owner:
- Cc:
- Status: closed
- Component: scrutinizer
- Estimated difficulty: medium
- Resolution: fixed
- Priority: major
- Milestone: 5.2
- Version: 5.1.0
- Changetime: 2019-12-01 01:14:49 UTC
- Created: 2019-09-20 12:52:26 UTC
- Keywords:
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 <--
Changes and comments
[2019-12-01 01:14:49 UTC] evhan changed status from new to closed
[2019-12-01 01:14:49 UTC] evhan set resolution to fixed
[2019-12-01 01:14:49 UTC] evhan wrote:
Fixed by d6359ebf. We could be smarter about determining the right types, but the incorrect type is no longer used.