From 7281188f5a79d2fb15ab6514e76a1d21e95442de Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 21 Jan 2023 17:24:43 -0500 Subject: Fix inference for top-level. --- chickadee/graphics/seagull.scm | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/chickadee/graphics/seagull.scm b/chickadee/graphics/seagull.scm index 4827577..41aacc1 100644 --- a/chickadee/graphics/seagull.scm +++ b/chickadee/graphics/seagull.scm @@ -685,16 +685,6 @@ ;; vec4, mat4 -> mat4 ;; mat4, vec4 -> mat4 -;; (+ x (+ 1 2)) -;; e a d b c - -;; ((= a (maybe (int ((= b int) (= c int))) -;; (float ((= b float) (= c float))))) -;; (= b (maybe (int ((= a int) (= c int))) -;; (float ((= a float) (= c float))))) -;; (= c (maybe (int ((= a int) (= b int))) -;; (float ((= a float) (= b float)))))) - (list (intersection-type (function-type (list int-type int-type) (list int-type)) @@ -1109,14 +1099,16 @@ (define sub0 (fold (lambda (exp subs) (compose-substitutions (infer exp) subs)) - (empty-env) + (infer body) exps)) + (define sub1 + (unify (apply-substitutions-to-types types sub0) + (apply-substitutions-to-types (texp-types body) sub0))) (compose-substitutions (infer body) sub0)) (define (infer exp) (match exp (('t types (or (? immediate?) ('var _ _))) - (pk 'infer:basic exp) '()) (('t types ('if predicate consequent alternate)) (infer:if types predicate consequent alternate)) -- cgit v1.2.3