elixir: fix map destructuring in function parameters#637
Merged
Conversation
Replace G.OtherParam with G.ParamPattern for OtherParamExpr and OtherParamPair in the Elixir-to-generic translation. Add Container(Dict) handling in expr_to_pattern so map patterns convert to PatList rather than falling through to opaque OtherPat.
Translate the => operator as keyval (Container(Tuple, ...)) instead of
Call(Id("=>"), ...) so arrow pairs share the same structure as keyword
pairs. Wrap map items in OtherExpr("MapPairArrow")/OtherExpr("MapPairKeyword")
to preserve syntax distinction for pattern matching. Add OtherExpr-to-OtherPat
conversion in expr_to_pattern, and unwrap the tags in AST_to_IL for Elixir.
Add dots_arrow_map test for arrow-syntax map patterns. Both tests include negative cases proving the two forms do not cross-match.
Collaborator
Author
|
I will add a taint test before merging |
maciejpirog
approved these changes
Apr 3, 2026
Contributor
That was my only suggestion here |
corneliuhoffman
approved these changes
Apr 3, 2026
Contributor
corneliuhoffman
left a comment
There was a problem hiding this comment.
I will add a taint test before merging
That was my only suggestion here
This was referenced Apr 3, 2026
Merged
tmeijn
pushed a commit
to tmeijn/dotfiles
that referenced
this pull request
Apr 8, 2026
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [opengrep/opengrep](https://github.com/opengrep/opengrep) | minor | `v1.16.5` → `v1.18.0` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>opengrep/opengrep (opengrep/opengrep)</summary> ### [`v1.18.0`](https://github.com/opengrep/opengrep/releases/tag/v1.18.0): Opengrep 1.18.0 [Compare Source](opengrep/opengrep@v1.17.0...v1.18.0) #### Improvements - Elixir: Updates to syntax (part 1) by [@​maciejpirog](https://github.com/maciejpirog) in [#​642](opengrep/opengrep#642) - Elixir: Updates to syntax (part 2) by [@​maciejpirog](https://github.com/maciejpirog) in [#​646](opengrep/opengrep#646) **Full Changelog**: <opengrep/opengrep@v1.17.0...v1.18.0> ### [`v1.17.0`](https://github.com/opengrep/opengrep/releases/tag/v1.17.0): Opengrep 1.17.0 [Compare Source](opengrep/opengrep@v1.16.5...v1.17.0) #### Improvements - Treat nested functions as lambdas by [@​dimitris-m](https://github.com/dimitris-m) in [#​621](opengrep/opengrep#621) - Tainting: per-arity signature extraction for Clojure and Elixir by [@​dimitris-m](https://github.com/dimitris-m) in [#​582](opengrep/opengrep#582) - Dockerfile: Preprocess for better line continuations and comments by [@​maciejpirog](https://github.com/maciejpirog) in [#​633](opengrep/opengrep#633) - Elixir: fix map destructuring in function parameters by [@​dimitris-m](https://github.com/dimitris-m) in [#​637](opengrep/opengrep#637) - Elixir: fix taint propagation through map value expressions by [@​dimitris-m](https://github.com/dimitris-m) in [#​640](opengrep/opengrep#640) - Support chained method calls on constructor results with --taint-intrafile by [@​corneliuhoffman](https://github.com/corneliuhoffman) in [#​638](opengrep/opengrep#638) #### Bug fixes - Fix(Ruby): zero argument method call syntax by [@​corneliuhoffman](https://github.com/corneliuhoffman) in [#​626](opengrep/opengrep#626) - Fix: proper constructor taint analysis by [@​corneliuhoffman](https://github.com/corneliuhoffman) in [#​628](opengrep/opengrep#628) - Fix: Elixir scanner CRLF handling by [@​dimitris-m](https://github.com/dimitris-m) in [#​639](opengrep/opengrep#639) #### Refactoring - Refactoring of AST-to-IL, Step 1 by [@​maciejpirog](https://github.com/maciejpirog) in [#​622](opengrep/opengrep#622) #### Developer tooling - Pretty-print IL in C-style syntax by [@​maciejpirog](https://github.com/maciejpirog) in [#​623](opengrep/opengrep#623) #### Installation - Improve error reporting in install.sh by [@​dimitris-m](https://github.com/dimitris-m) in [#​620](opengrep/opengrep#620) #### Security - \[Aikido] AI Fix for Template Injection in GitHub Workflows Action by [@​aikido-autofix](https://github.com/aikido-autofix)\[bot] in [#​624](opengrep/opengrep#624) - \[Aikido] AI Fix for 3rd party Github Actions should be pinned by [@​aikido-autofix](https://github.com/aikido-autofix)\[bot] in [#​625](opengrep/opengrep#625) **Full Changelog**: <opengrep/opengrep@v1.16.5...v1.17.0> </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMDQuMSIsInVwZGF0ZWRJblZlciI6IjQzLjEwNC44IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiLCJhdXRvbWF0aW9uOmJvdC1hdXRob3JlZCIsImRlcGVuZGVuY3ktdHlwZTo6bWlub3IiXX0=-->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OtherParamwithParamPatternfor Elixir map-destructured function parameters, enabling taint analysis to track data flow through%{"key" => val}and%{key: val}patterns.=>askeyval(Container(Tuple, ...)) instead ofCall(Id("=>"), ...), matching the existing keyword pair representation.OtherExpr("MapPairArrow")/OtherExpr("MapPairKeyword")so search patterns can distinguish the two syntactic forms.Container(Dict)andOtherExprcases toexpr_to_pattern; unwrap the map pair tags inAST_to_ILfor Elixir.Test plan
dots_arrow_maptest: arrow-syntax map patterns match arrow maps, reject keyword maps.dots_kw_maptest: keyword-syntax map patterns match keyword maps, reject arrow maps.