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