Fix up singleton values

This commit is contained in:
Sam Tobin-Hochstadt 2008-07-07 14:49:46 -04:00
parent 044bd551b0
commit d0939ffa1e
2 changed files with 9 additions and 3 deletions

View File

@ -464,7 +464,7 @@
;; and T-dotted is the repeated type
(define (infer/dots X dotted-var S T T-dotted R must-vars [expected #f])
(with-handlers ([exn:infer? (lambda _ #f)])
(let* ([short-S (debug (take S (length T)))]
(let* ([short-S (take S (length T))]
[rest-S (drop S (length T))]
[cs-short (cgen/list null (cons dotted-var X) short-S T)]
[new-vars (for/list ([i (in-range (length rest-S))]) (gensym dotted-var))]
@ -484,4 +484,4 @@
(define (i s t r)
(infer/simple (list s) (list t) r))
(trace cgen/arr cgen cgen/list)
;;(trace cgen/arr cgen cgen/list)

View File

@ -56,6 +56,12 @@
(make-ValuesDots (map sb types) (sb dty) dbound))])
target))
;; the other definition is not accessible here
(define (-values args)
(if (= (length args) 1)
(car args)
(make-Values args)))
;; substitute-dots : Listof[Type] Option[type] Name Type -> Type
(define (substitute-dots images rimage name target)
(define (sb t) (substitute-dots images rimage name t))
@ -63,7 +69,7 @@
(type-case sb target
[#:ValuesDots types dty dbound
(if (eq? name dbound)
(make-Values
(-values
(append
(map sb types)
;; We need to recur first, just to expand out any dotted usages of this.