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

original commit: d0bab9953508c8e1ff4bf126d33dd8cf4d16bdd1
This commit is contained in:
Vincent St-Amour 2011-03-01 13:32:53 -05:00
parent 246498613a
commit 4f37500ccb

View File

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