diff --git a/scheme/bcomp/mtype.scm b/scheme/bcomp/mtype.scm index 2354cf6..d878d3d 100644 --- a/scheme/bcomp/mtype.scm +++ b/scheme/bcomp/mtype.scm @@ -1,4 +1,4 @@ -; Copyright (c) 1993-1999 by Richard Kelsey and Jonathan Rees. See file COPYING. +; Copyright (c) 1993-2001 by Richard Kelsey and Jonathan Rees. See file COPYING. ; Type lattice. ; Sorry this is so hairy, but before it was written, type checking @@ -619,6 +619,8 @@ (reduce join-type (car l) (cdr l)))) ((mask->type) (mask->type (cadr x))) + ((variable) + (variable-type (sexp->type (cadr x) r?))) (else (error "unrecognized type" x)))) (else (error "unrecognized type" x)))) @@ -641,18 +643,20 @@ ; Convert type to S-expression (define (type->sexp t r?) - (if (> (bitwise-and (type-mask t) mask/&rest) 0) - (if (same-type? t any-values-type) - ':values - `(some-values ,@(rail-type->sexp t r?))) - (let ((j (disjoin-type t))) - (cond ((null? j) ':error) - ((null? (cdr j)) - (atomic-type->sexp (car j) r?)) - (else - `(join ,@(map (lambda (t) - (atomic-type->sexp t r?)) - j))))))) + (if (variable-type? t) + `(variable ,(type->sexp (variable-value-type t) r?)) + (if (> (bitwise-and (type-mask t) mask/&rest) 0) + (if (same-type? t any-values-type) + ':values + `(some-values ,@(rail-type->sexp t r?))) + (let ((j (disjoin-type t))) + (cond ((null? j) ':error) + ((null? (cdr j)) + (atomic-type->sexp (car j) r?)) + (else + `(join ,@(map (lambda (t) + (atomic-type->sexp t r?)) + j)))))))) (define (atomic-type->sexp t r?) (let ((m (type-mask t)))