Move subtype check in inference engine earlier, for performance reasons.

This commit is contained in:
Vincent St-Amour 2011-03-01 13:32:53 -05:00
parent e450e2815b
commit d0bab99535

View File

@ -320,6 +320,12 @@
;; CG-Top ;; CG-Top
[(_ (Univ:)) empty] [(_ (Univ:)) empty]
;; they're subtypes. easy.
[(a b) (=> nevermind)
(if (subtype a b)
empty
(nevermind))]
;; refinements are erased to their bound ;; refinements are erased to their bound
[((Refinement: S _ _) T) [((Refinement: S _ _) T)
(cg S T)] (cg S T)]
@ -525,11 +531,8 @@
(cgen/filter-set V X Y f-s f-t) (cgen/filter-set V X Y f-s f-t)
(cgen/object V X Y o-s o-t)))] (cgen/object V X Y o-s o-t)))]
[(_ _) [(_ _)
(cond ;; nothing worked, and we fail
;; subtypes are easy - should this go earlier? (fail! S T)]))))
[(subtype S T) empty]
;; or, nothing worked, and we fail
[else (fail! S T)])]))))
;; C : cset? - set of constraints found by the inference engine ;; C : cset? - set of constraints found by the inference engine
;; Y : (listof symbol?) - index variables that must have entries ;; Y : (listof symbol?) - index variables that must have entries