[Top][All Lists]

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

[Chicken-hackers] OPATCHO Fix procedure subtype relation when #!rest is

From: megane
Subject: [Chicken-hackers] OPATCHO Fix procedure subtype relation when #!rest is involved
Date: Thu, 24 May 2018 14:11:42 +0300
User-agent: mu4e 0.9.18; emacs 25.1.1


Currently this doesn't compile:
(compiler-typecase (the (#!rest fixnum -> *) 1)
  ((fixnum fixnum -> *) 1))

Error: at toplevel:
(rest.scm:7) no clause applies in `compiler-typecase' for expression of type 
`(procedure (#!rest fixnum) *)':
(procedure (fixnum fixnum) *)

Here's a more concrete case where this happens. The warning only appears
when the procedure contravariant patch is applied:

(: foo ((number number -> number) number number -> number))
(define (foo f a b)
(f a b))

(print (foo max 1 2))

Warning: at toplevel:
  (rest.scm:14) in procedure call to `foo', expected argument #1 of type
  `(procedure (number number) number)' but was given an argument of type
  `(procedure max (#!rest number) number)'

Attachment: fix-procedure-subtyping-with-rest.patch
Description: Text Data

reply via email to

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