promote a lone arithmetic operand
One operand was joined with nothing and came back as it was, so (- c) over a char was a char where C makes it an int.
This commit is contained in:
11
semen.scm
11
semen.scm
@@ -1359,11 +1359,14 @@
|
||||
;;; (+ (& p) 1) -> (* (struct point))
|
||||
;;;
|
||||
;;; `unsigned int' against `int' answers `int', where C says otherwise.
|
||||
;;; One operand is promoted on its own: (- c), c : char -> int
|
||||
(define (arithmetic-type expr env)
|
||||
(fold (lambda (operand joined)
|
||||
(arith-join joined (expression-type operand env)))
|
||||
#f
|
||||
(cdr expr)))
|
||||
(if (null? (cddr expr))
|
||||
(promoted-type (expression-type (second expr) env))
|
||||
(fold (lambda (operand joined)
|
||||
(arith-join joined (expression-type operand env)))
|
||||
#f
|
||||
(cdr expr))))
|
||||
|
||||
;;; A pointer, or an array that is one as an operand
|
||||
(define (address? written)
|
||||
|
||||
Reference in New Issue
Block a user