Fix repeated type ascription.

original commit: d2a1470ea51b5ca55656833f95dacd5ae7ba1285
This commit is contained in:
Sam Tobin-Hochstadt 2010-05-17 16:20:44 -05:00
parent 2776f825c2
commit 29cd6cac2f
2 changed files with 27 additions and 2 deletions

View File

@ -0,0 +1,12 @@
#lang typed/scheme
(require racket/flonum)
(define-syntax FLOAT* (syntax-rules () ((FLOAT* x ...) (ann (* (ann x Float) ...) Float))))
(define-syntax FLOATsin (syntax-rules () ((FLOATsin x) (ann (flsin (ann x Float)) Float))))
(: tfo-align Any)
(define (tfo-align) 0.0
(let* ((x (FLOAT* 0.0 (FLOATsin 0.))))
0))

View File

@ -63,11 +63,24 @@
(parse-tc-results prop)
(parse-tc-results/id stx prop)))
(cond
[(syntax-property stx type-ascrip-symbol) => pt]
[(syntax-property stx type-ascrip-symbol)
=>
(lambda (prop)
(if (pair? prop)
(pt (car prop))
(pt prop)))]
[else #f]))
(define (remove-ascription stx)
(syntax-property stx type-ascrip-symbol #f))
(syntax-property stx type-ascrip-symbol
(cond
[(syntax-property stx type-ascrip-symbol)
=>
(lambda (prop)
(if (pair? prop)
(cdr prop)
#f))]
[else #f])))
(define (log/ann stx ty)
(printf/log "Required Annotated Variable: ~a ~a~n" (syntax-e stx) ty))