[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-janitors] #1533: Scrutinizer seems to get confused about li
From: |
Chicken Trac |
Subject: |
Re: [Chicken-janitors] #1533: Scrutinizer seems to get confused about list length |
Date: |
Mon, 10 Sep 2018 09:39:53 -0000 |
#1533: Scrutinizer seems to get confused about list length
------------------------------------+---------------------------
Reporter: sjamaan | Owner:
Type: defect | Status: new
Priority: major | Milestone: 5.0
Component: scrutinizer | Version: 5.0.0rc2
Resolution: | Keywords: flow analysis
Estimated difficulty: hard |
------------------------------------+---------------------------
Comment (by megane):
There's at least two things going on here.
First is type smashing. The calls to `usage`, which has unknown type
smashes the type of `args` to `(or pair null)`. This can be avoided by
moving the `usage` calls to tail call positions.
In theory, defining `usage` like this should help:
{{{
(define usage
(the (#!optional fixnum -> noreturn)
(lambda (#!optional exit-code)
(when exit-code
(exit exit-code)))))
}}}
But doesn't, for some reason.
Secondly, there's an issue with refinement:
{{{
(import scheme (chicken base) (chicken type))
(let ([a (the (or pair null) (cons 1 '()))])
(length a) ; refine (or pair null) with list (= (or pair null))
(compiler-typecase a ((not *) 1)))
;;
;; Error: at toplevel:
;; (hoi.scm:33) no clause applies in `compiler-typecase' for expression
of type `null':
;; (not *)
}}}
The type should stay `(or pair null)`, but is refined to `null`.
--
Ticket URL: <https://bugs.call-cc.org/ticket/1533#comment:1>
CHICKEN Scheme <https://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.