chicken-janitors
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-janitors] #1649: foreign-lambda annotates return type without c


From: Chicken Trac
Subject: [Chicken-janitors] #1649: foreign-lambda annotates return type without considering retconvert from define-foreign-type
Date: Fri, 20 Sep 2019 10:52:26 -0000

#1649: foreign-lambda annotates return type without considering retconvert from
define-foreign-type
-------------------------------+-------------------------
            Reporter:  megane  |       Type:  defect
              Status:  new     |   Priority:  major
           Milestone:  5.2     |  Component:  scrutinizer
             Version:  5.1.0   |   Keywords:
Estimated difficulty:  medium  |
-------------------------------+-------------------------
 {{{
 (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             <--

 }}}

-- 
Ticket URL: <https://bugs.call-cc.org/ticket/1649>
CHICKEN Scheme <https://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]