Skip to content

Python: Basic support for match statement#7356

Closed
yoff wants to merge 21 commits intogithub:mainfrom
yoff:python/test-match
Closed

Python: Basic support for match statement#7356
yoff wants to merge 21 commits intogithub:mainfrom
yoff:python/test-match

Conversation

@yoff
Copy link
Contributor

@yoff yoff commented Dec 10, 2021

QL part of https://github.com/github/semmle-code/pull/41110.

  • AST nodes for patterns
    • sub expressions, sub statements, and sub patterns
    • add sub patterns to the new case statement
    • scopes for patterns computed as the scope of the enclosing case (could be added to py_scopes instead)
  • SSA for variables created inside match statements
    • PatternCaptureDefinition and PatternAliasDefinition
  • data flow through patterns
    • subject of match flows to each top-level pattern (could be more like use-use-flow and only flow directly to the first one)
    • shape based flow inside patterns
      • MatchAsPattern
      • MatchOrPattern
      • MatchLiteralPattern (no flow)
      • MatchCapturePattern
      • MatchWildcardPattern (no flow)
      • MatchValuePattern (no flow)
      • MatchSequencePattern
        • when tuple
        • when list
      • MatchStarPattern
      • MatchMappingPattern
      • MatchDoubleStarPattern
      • MatchKeyValuePattern
      • MatchClassPattern
        • for keyword arguments
        • for positional arguments
      • MatchKeywordPattern
  • create upgrade script
  • create downgrade script

@yoff yoff requested a review from a team as a code owner December 10, 2021 21:11
yoff added 2 commits December 13, 2021 13:30
To fix this properly we should also rename the generated class.
Alternatively, we should rename the branch in ReDoS,
but that is a shared file.
This to make tests pass, beware that
the classes are not yet complete.
@yoff yoff marked this pull request as draft January 10, 2022 08:46
@yoff yoff marked this pull request as ready for review January 14, 2022 09:58
This was referenced Jan 18, 2022
@yoff
Copy link
Contributor Author

yoff commented Jan 18, 2022

Superseeded by #7635

@yoff yoff closed this Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant