Compare commits

..

No commits in common. "89a081770eaea2a6e09193c21e86200518a69c46" and "5f36bf97e617a575d059d7548dbc596c2bbb3e14" have entirely different histories.

View File

@ -390,16 +390,16 @@
(let* ([arg-type (parse-type te)] (let* ([arg-type (parse-type te)]
[res-type (typecheck body (BindType name arg-type env))]) [res-type (typecheck body (BindType name arg-type env))])
(arrowT arg-type res-type))] (arrowT arg-type res-type))]
[(listE elements) (local ;; this sucks. do not think it's right but it passes tests [(listE elements) (local [(define type-list (map (lambda (x) (typecheck x env)) elements))
[(define type-list (map (lambda (x) (typecheck x env)) elements)) (define filtered (filter (lambda (x) (equal? (first type-list) x)) type-list))]
(define filtered (filter (lambda (x) (equal? (first type-list) x)) type-list))
(define (check-all lst)
(type-case Type (first type-list)
[(varT v t) (second type-list)]
[else (error 'typecheck "no type")]))]
(if (equal? filtered type-list) (if (equal? filtered type-list)
(listT (first type-list)) (listT (first type-list))
(listT (check-all type-list))))])) (type-case Type (first type-list)
[(varT v t) (if (none? (unbox t))
(listT (second type-list))
(error 'typecheck "no type"))]
[else (error 'typecheck "no type")])))]
))
;; ---------------------------------------- ;; ----------------------------------------
(define-syntax-rule (test/type expr type) (define-syntax-rule (test/type expr type)