Fix handling of structs-as-functions.
Subtyping should look up names in both positions. svn: r14827
This commit is contained in:
parent
b2cf9c0006
commit
ddefd28d6d
|
@ -555,8 +555,8 @@
|
||||||
(infer/dots fixed-vars dotted-var argtys-t dom dty rng (fv rng) #:expected (and expected (tc-results->values expected))))
|
(infer/dots fixed-vars dotted-var argtys-t dom dty rng (fv rng) #:expected (and expected (tc-results->values expected))))
|
||||||
t argtys expected)]
|
t argtys expected)]
|
||||||
;; procedural structs
|
;; procedural structs
|
||||||
[(tc-result1: (and sty (Struct: _ _ _ (? Type? proc-ty) _ _ _)))
|
[((tc-result1: (and sty (Struct: _ _ _ (? Function? proc-ty) _ _ _))) _)
|
||||||
(tc/funapp f-stx (cons (syntax/loc f-stx dummy) args-stx) (ret proc-ty) (cons sty argtys) expected)]
|
(tc/funapp f-stx #`(#,(syntax/loc f-stx dummy) . #,args-stx) (ret proc-ty) (cons ftype0 argtys) expected)]
|
||||||
;; parameters are functions too
|
;; parameters are functions too
|
||||||
[((tc-result1: (Param: in out)) (list)) (ret out)]
|
[((tc-result1: (Param: in out)) (list)) (ret out)]
|
||||||
[((tc-result1: (Param: in out)) (list (tc-result1: t)))
|
[((tc-result1: (Param: in out)) (list (tc-result1: t)))
|
||||||
|
|
|
@ -303,10 +303,14 @@
|
||||||
v))]
|
v))]
|
||||||
[(list (Name: n) other)
|
[(list (Name: n) other)
|
||||||
(let ([t (lookup-type-name n)])
|
(let ([t (lookup-type-name n)])
|
||||||
;(printf "subtype: name: ~a ~a ~a~n" (syntax-e n) t other)
|
|
||||||
(if (Type? t)
|
(if (Type? t)
|
||||||
(subtype* A0 t other)
|
(subtype* A0 t other)
|
||||||
(fail! s t)))]
|
(fail! s t)))]
|
||||||
|
[(list other (Name: n))
|
||||||
|
(let ([t (lookup-type-name n)])
|
||||||
|
(if (Type? t)
|
||||||
|
(subtype* A0 other t)
|
||||||
|
(fail! t s)))]
|
||||||
;; Promises are covariant
|
;; Promises are covariant
|
||||||
[(list (Struct: 'Promise _ (list t) _ _ _ _) (Struct: 'Promise _ (list t*) _ _ _ _)) (subtype* A0 t t*)]
|
[(list (Struct: 'Promise _ (list t) _ _ _ _) (Struct: 'Promise _ (list t*) _ _ _ _)) (subtype* A0 t t*)]
|
||||||
;; subtyping on values is pointwise
|
;; subtyping on values is pointwise
|
||||||
|
|
Loading…
Reference in New Issue
Block a user