chicken-janitors
[Top][All Lists]
Advanced

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

Re: [Chicken-janitors] #1399: Scrutinizer produces incorrect procedure t


From: Chicken Trac
Subject: Re: [Chicken-janitors] #1399: Scrutinizer produces incorrect procedure types after merge
Date: Sun, 27 May 2018 13:52:14 -0000

#1399: Scrutinizer produces incorrect procedure types after merge
------------------------------------+----------------------
            Reporter:  LemonBoy     |      Owner:  evhan
                Type:  defect       |     Status:  reopened
            Priority:  major        |  Milestone:  5.0
           Component:  scrutinizer  |    Version:  4.12.0
          Resolution:               |   Keywords:
Estimated difficulty:  medium       |
------------------------------------+----------------------

Comment (by megane):

 The idea of merging procedure argument and return types piecemeal, as it's
 currently done, is fundamentally flawed. See below:
 {{{
 (: f1 (fixnum -> *))
 (define (f1 a)
   (+ a 1))

 (: f2 (string -> *))
 (define (f2 a)
   (string-length a))

 (: foo (((or fixnum string) -> *) -> *))
 (define (foo f)
   (print (f 1))
   (print (f "hello")))

 ;; (compiler-typecase (if (the * #t) f1 f2) ((not *) 1))
 ;; Error: at toplevel:
 ;;   (procedure-merge-fail.scm:14) no clause applies in `compiler-
 typecase' for expression of type `(procedure ((or string fixnum)) *)':
 ;;     (not *)

 (foo (lambda (a) (if (string? a) (f2 a) (f1 a))))
 (foo (if (the * #t) f2 f1))

 ;; $ csc -O3 procedure-merge-fail.scm && ./procedure-merge-fail
 ;; 2
 ;; 5
 ;;
 ;; Error: (string-length) bad argument type: 1
 ;;
 ;;      Call history:
 ;;
 ;;      procedure-merge-fail.scm:19: foo
 ;;      procedure-merge-fail.scm:11: f
 ;;      procedure-merge-fail.scm:11: chicken.base#print
 ;;      procedure-merge-fail.scm:12: f
 ;;      procedure-merge-fail.scm:12: chicken.base#print
 ;;      procedure-merge-fail.scm:20: foo
 ;;      procedure-merge-fail.scm:11: f          <--
 }}}

--
Ticket URL: <https://bugs.call-cc.org/ticket/1399#comment:9>
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]