Borrow checker is confused by using a match-ref with a let block
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 6k
- Forks
- 187
- Avg merge
- 8d 22h
- Merged PRs (30d)
- 4
Description
The following code produces a borrow checker error even though there is no shared values between the two match-ref:
```clojure
(deftype Sum One Two)
(defn main []
(do
(let []
(match-ref &(Sum.One)
Sum.One ()
Sum.Two ()))
(match-ref &(Sum.Two)
Sum.One ()
Sum.Two ())))
```
```
The reference '(ref (Sum.Two))' (depending on the variable '_9') isn't alive at line 9, column 15 in '/tmp/main.carp'. at /tmp/main.carp:3:1.
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named. Start by running the provided Carp reproduction and trace the borrow-checker path that reports the lifetime error; done means the example compiles without the false borrow error while preserving the behavior of both match-ref expressions.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100