Skip to content

fix: match-ref bug - #1611

Draft
eriksvedang wants to merge 2 commits into
masterfrom
fix-match-ref-bug
Draft

eriksvedang wants to merge 2 commits into
masterfrom
fix-match-ref-bug

Conversation

@eriksvedang

Copy link
Copy Markdown
Collaborator

I solved this bug using my gut, need to think a bit more about it before it goes in :)

(and I'll add regression tests)

Closes #1610.

Comment on lines +136 to +137
mkExprConstr x@(XObj (Sym _symPath _symMode) _ (Just t)) =
Just (Constraint (wrapInRefTyIfMatchRef matchMode t) (wrapInRefTyIfMatchRef matchMode exprType) x expr xobj OrdArg)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this drops the check that the matched expression of a match-ref is a ref. before, Ref t ~ exprType forced exprType to be a ref.

now i can just (defn r [] (match-ref (Maybe.Just @"leak") _ 1)), have it compile, and it’ll leak.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

match-ref binds a catch-all variable by value

2 participants