diff options
author | David Thompson <dthompson2@worcester.edu> | 2023-01-21 17:24:43 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2023-06-08 08:14:41 -0400 |
commit | 7281188f5a79d2fb15ab6514e76a1d21e95442de (patch) | |
tree | 79acc76b1165e5b7ce7c7fcbf42469bb50bb43c4 | |
parent | a782b3788a0bfbe22ae1e4d3cb96157bdf6dbcf0 (diff) |
Fix inference for top-level.
-rw-r--r-- | chickadee/graphics/seagull.scm | 16 |
1 files 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)) |