Skip to content

Commit

Permalink
Removing add star for type inference.
Browse files Browse the repository at this point in the history
Before this change the following pattern failed:

```clojure
(m/match [:d {}]
  [_ [[] ...]]
  :nope

  [_ {}]
  :yep)
```

I had previously added inference about :star. I had done that assuming a few things that were just wrong. The target here doesn't have to match just because we have a star. I also inferred the wrong type for the function argument. Removing this fixes a bug and shouldn't make much difference in performance.
  • Loading branch information
jimmyhmiller committed Jan 18, 2020
1 parent a8efa78 commit c64d586
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/meander/match/ir/epsilon.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -942,17 +942,11 @@ compilation decisions."

:else nil))

(defn add-type-if-star [env node]
(add-type-to-env env (:form (:input node)) (kind-types (:kind node)))
(add-type-to-env env (:input-symbol node) (kind-types (:kind node))))

(defn infer-collection-type
{:private true}
[env node]
(case (op node)
:star
(do (add-type-if-star env node)
node)

:apply
(do
Expand Down

0 comments on commit c64d586

Please sign in to comment.