From 4f37500ccbf46f9d3f976722c64be2e4c9281362 Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Tue, 1 Mar 2011 13:32:53 -0500 Subject: [PATCH] Move subtype check in inference engine earlier, for performance reasons. original commit: d0bab9953508c8e1ff4bf126d33dd8cf4d16bdd1 --- collects/typed-scheme/infer/infer-unit.rkt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/collects/typed-scheme/infer/infer-unit.rkt b/collects/typed-scheme/infer/infer-unit.rkt index cd27171f..6d13c892 100644 --- a/collects/typed-scheme/infer/infer-unit.rkt +++ b/collects/typed-scheme/infer/infer-unit.rkt @@ -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