Commit 86e409f
authored
fix: properly assign types to recursive calls (#1210)
This commit fixes an issue whereby all recursive calls were given var
types, this resulted in strange behavior such as the following code:
```clojure
(defn recurse [a b]
(let [c (+ b 1)
out (recurse c)]
(+ out 1)))
(defn main []
(println* (recurse 1 2)))
```
compiling just fine and yielding runtime segfaults. Now, if a recursive
instance of a symbol was previously typed, we use that type--if not, we
assign a fresh type variable (the old behavior). This fixes code like
that above, throwing an error at compile time about an incorrect number
of arguments for `recurse`.
Fixes #3481 parent e7746c3 commit 86e409f
1 file changed
+10
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
124 | 129 | | |
125 | 130 | | |
126 | 131 | | |
| |||
0 commit comments