Compare commits
	
		
			3 Commits
		
	
	
		
			5f36bf97e6
			...
			89a081770e
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 89a081770e | |||
| 36b11904da | |||
| 3e2649e2db | 
@@ -390,16 +390,16 @@
 | 
			
		||||
     (let* ([arg-type (parse-type te)]
 | 
			
		||||
            [res-type (typecheck body (BindType name arg-type env))])
 | 
			
		||||
       (arrowT arg-type res-type))]
 | 
			
		||||
    [(listE elements) (local [(define type-list (map (lambda (x) (typecheck x env)) elements))
 | 
			
		||||
                              (define filtered (filter (lambda (x) (equal? (first type-list) x)) type-list))]
 | 
			
		||||
    [(listE elements) (local ;; this sucks. do not think it's right but it passes tests
 | 
			
		||||
                        [(define type-list (map (lambda (x) (typecheck x env)) elements))
 | 
			
		||||
                         (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)
 | 
			
		||||
                            (listT (first 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")])))]
 | 
			
		||||
    ))
 | 
			
		||||
                            (listT (check-all type-list))))]))
 | 
			
		||||
;; ----------------------------------------
 | 
			
		||||
 | 
			
		||||
(define-syntax-rule (test/type expr type)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user