Make tests pass
This commit is contained in:
parent
b13264feed
commit
25758dc44a
@ -127,9 +127,11 @@
|
|||||||
(if (equal? var-t val-t)
|
(if (equal? var-t val-t)
|
||||||
body-t
|
body-t
|
||||||
(error 'typecheck "type does not match annotation")))]
|
(error 'typecheck "type does not match annotation")))]
|
||||||
[(objE fields) (let* ([extract-exp (lambda (obj) (pair (fst obj) (typecheck (snd obj) env)))]
|
[(objE fields)
|
||||||
[field-list (map extract-exp fields)])
|
(let*
|
||||||
(objT (make-hash field-list)))]
|
([extract-exp (lambda (obj) (pair (fst obj) (typecheck (snd obj) env)))]
|
||||||
|
[field-list (map extract-exp fields)])
|
||||||
|
(objT (hash field-list)))]
|
||||||
[(msgE obj selector)
|
[(msgE obj selector)
|
||||||
(type-case Exp obj
|
(type-case Exp obj
|
||||||
[(objE fields)
|
[(objE fields)
|
||||||
@ -141,7 +143,9 @@
|
|||||||
[(objT fields)
|
[(objT fields)
|
||||||
(type-case (Optionof Type) (hash-ref fields selector)
|
(type-case (Optionof Type) (hash-ref fields selector)
|
||||||
[(none) (error 'typecheck "unknown field")]
|
[(none) (error 'typecheck "unknown field")]
|
||||||
[(some v) v])]
|
[(some v) (type-case Type v
|
||||||
|
[(arrowT arg-type result-type) v ]
|
||||||
|
[else v])])]
|
||||||
[else (error 'typecheck "bound variable is not an object")])]
|
[else (error 'typecheck "bound variable is not an object")])]
|
||||||
[else (error 'typecheck "passing message to non-object")])])))
|
[else (error 'typecheck "passing message to non-object")])])))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user