Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mypyc] Add match statement support #13953

Merged
merged 102 commits into from
Dec 2, 2022
Merged

[mypyc] Add match statement support #13953

merged 102 commits into from
Dec 2, 2022

Commits on Oct 9, 2022

  1. Add match statement entrypoint:

    Still getting a grip with how mypyc does things, but I feel like I am at a spot
    where I can actually start doing things now.
    dosisod committed Oct 9, 2022
    Configuration menu
    Copy the full SHA
    3e6744e View commit details
    Browse the repository at this point in the history
  2. Cleanup

    dosisod committed Oct 9, 2022
    Configuration menu
    Copy the full SHA
    39f366d View commit details
    Browse the repository at this point in the history

Commits on Oct 10, 2022

  1. Add value pattern check

    dosisod committed Oct 10, 2022
    Configuration menu
    Copy the full SHA
    8bee07a View commit details
    Browse the repository at this point in the history
  2. Cleanup

    dosisod committed Oct 10, 2022
    Configuration menu
    Copy the full SHA
    0883015 View commit details
    Browse the repository at this point in the history

Commits on Oct 11, 2022

  1. Reset

    dosisod committed Oct 11, 2022
    Configuration menu
    Copy the full SHA
    e646c44 View commit details
    Browse the repository at this point in the history
  2. Add value pattern

    dosisod committed Oct 11, 2022
    Configuration menu
    Copy the full SHA
    b27b380 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    f1e6a30 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    31e3ace View commit details
    Browse the repository at this point in the history
  5. Add one

    dosisod committed Oct 11, 2022
    Configuration menu
    Copy the full SHA
    538d488 View commit details
    Browse the repository at this point in the history
  6. Generalize

    dosisod committed Oct 11, 2022
    Configuration menu
    Copy the full SHA
    b653335 View commit details
    Browse the repository at this point in the history
  7. Minimize

    dosisod committed Oct 11, 2022
    Configuration menu
    Copy the full SHA
    2870c8e View commit details
    Browse the repository at this point in the history
  8. Rearange codeblock

    dosisod committed Oct 11, 2022
    Configuration menu
    Copy the full SHA
    988769d View commit details
    Browse the repository at this point in the history
  9. Cleanup

    dosisod committed Oct 11, 2022
    Configuration menu
    Copy the full SHA
    6cae5f8 View commit details
    Browse the repository at this point in the history
  10. Make it more readable

    dosisod committed Oct 11, 2022
    Configuration menu
    Copy the full SHA
    856dc85 View commit details
    Browse the repository at this point in the history
  11. Add class pattern support

    dosisod committed Oct 11, 2022
    Configuration menu
    Copy the full SHA
    65c9aae View commit details
    Browse the repository at this point in the history

Commits on Oct 12, 2022

  1. Add wildcard

    dosisod committed Oct 12, 2022
    Configuration menu
    Copy the full SHA
    2955d9f View commit details
    Browse the repository at this point in the history
  2. Add multibody support

    dosisod committed Oct 12, 2022
    Configuration menu
    Copy the full SHA
    96fb472 View commit details
    Browse the repository at this point in the history
  3. Fix failing tests

    dosisod committed Oct 12, 2022
    Configuration menu
    Copy the full SHA
    f961fd0 View commit details
    Browse the repository at this point in the history
  4. Add final block gotos

    dosisod committed Oct 12, 2022
    Configuration menu
    Copy the full SHA
    899c954 View commit details
    Browse the repository at this point in the history
  5. Add complex sanity test

    dosisod committed Oct 12, 2022
    Configuration menu
    Copy the full SHA
    dcf84e0 View commit details
    Browse the repository at this point in the history
  6. Add run test

    dosisod committed Oct 12, 2022
    Configuration menu
    Copy the full SHA
    eb2dc2d View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    522461d View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    8ce67d9 View commit details
    Browse the repository at this point in the history
  9. Add singleton pattern

    dosisod committed Oct 12, 2022
    Configuration menu
    Copy the full SHA
    c364489 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    d43e8ca View commit details
    Browse the repository at this point in the history

Commits on Oct 14, 2022

  1. Move code_block out

    dosisod committed Oct 14, 2022
    Configuration menu
    Copy the full SHA
    acdeb33 View commit details
    Browse the repository at this point in the history
  2. Move out next_block

    dosisod committed Oct 14, 2022
    Configuration menu
    Copy the full SHA
    beb1476 View commit details
    Browse the repository at this point in the history
  3. Cleanup

    dosisod committed Oct 14, 2022
    Configuration menu
    Copy the full SHA
    4d8cbc3 View commit details
    Browse the repository at this point in the history
  4. Add elifs

    dosisod committed Oct 14, 2022
    Configuration menu
    Copy the full SHA
    a332551 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    8fd6546 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    42b8d58 View commit details
    Browse the repository at this point in the history
  7. Add recursive matching

    dosisod committed Oct 14, 2022
    Configuration menu
    Copy the full SHA
    130647e View commit details
    Browse the repository at this point in the history

Commits on Oct 15, 2022

  1. Add basic AsPattern support

    dosisod committed Oct 15, 2022
    Configuration menu
    Copy the full SHA
    cc9f375 View commit details
    Browse the repository at this point in the history

Commits on Oct 16, 2022

  1. Configuration menu
    Copy the full SHA
    331531b View commit details
    Browse the repository at this point in the history
  2. Convert to visitor

    dosisod committed Oct 16, 2022
    Configuration menu
    Copy the full SHA
    92b05b8 View commit details
    Browse the repository at this point in the history
  3. Rewrite using visitor

    dosisod committed Oct 16, 2022
    Configuration menu
    Copy the full SHA
    2e1a2ad View commit details
    Browse the repository at this point in the history
  4. Add basic AsPattern support for ValuePattern:

    Since the AsPattern binds a value to name, it is very coupled to the pattern
    that is actually being built. There is (in general) 3 stages to a typical
    pattern match:
    
    1. Converting the expression to a value/register
    2. Checking if the match was successful
    3. Assigning the value to a variable if it is an AsPattern
    
    For this to work though, steps 2 and 3 need to be done at the same time,
    because the jump must jump to a block which sets the variable.
    Maybe I am wrong, and I can just assign to a variable, and if the match
    did not pass, it will simply be reassigned.
    dosisod committed Oct 16, 2022
    Configuration menu
    Copy the full SHA
    c55236e View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    0af9b24 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    aedd1a6 View commit details
    Browse the repository at this point in the history
  7. Cleanup

    dosisod committed Oct 16, 2022
    Configuration menu
    Copy the full SHA
    5b95596 View commit details
    Browse the repository at this point in the history

Commits on Oct 19, 2022

  1. Configuration menu
    Copy the full SHA
    25d0edc View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b85f178 View commit details
    Browse the repository at this point in the history
  3. Use self.code_block

    dosisod committed Oct 19, 2022
    Configuration menu
    Copy the full SHA
    9293549 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    2132f78 View commit details
    Browse the repository at this point in the history
  5. Add better scoping entering

    dosisod committed Oct 19, 2022
    Configuration menu
    Copy the full SHA
    c5dd161 View commit details
    Browse the repository at this point in the history
  6. Split context managers

    dosisod committed Oct 19, 2022
    Configuration menu
    Copy the full SHA
    c64c343 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    49d60c8 View commit details
    Browse the repository at this point in the history

Commits on Oct 20, 2022

  1. Configuration menu
    Copy the full SHA
    1deecb4 View commit details
    Browse the repository at this point in the history
  2. Add positional captures

    dosisod committed Oct 20, 2022
    Configuration menu
    Copy the full SHA
    df4a146 View commit details
    Browse the repository at this point in the history
  3. Add basic mapping support

    dosisod committed Oct 20, 2022
    Configuration menu
    Copy the full SHA
    0376526 View commit details
    Browse the repository at this point in the history

Commits on Oct 21, 2022

  1. Add key value patterns

    dosisod committed Oct 21, 2022
    Configuration menu
    Copy the full SHA
    5e479b0 View commit details
    Browse the repository at this point in the history
  2. Add basic mapping rest

    dosisod committed Oct 21, 2022
    Configuration menu
    Copy the full SHA
    820b9bd View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    29eadd5 View commit details
    Browse the repository at this point in the history
  4. Cleanup

    dosisod committed Oct 21, 2022
    Configuration menu
    Copy the full SHA
    d538d69 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    553e41c View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    5c8b4c5 View commit details
    Browse the repository at this point in the history
  7. Add a bunch of tests

    dosisod committed Oct 21, 2022
    Configuration menu
    Copy the full SHA
    ec128ad View commit details
    Browse the repository at this point in the history

Commits on Oct 23, 2022

  1. Configuration menu
    Copy the full SHA
    1b0523b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    626d8f1 View commit details
    Browse the repository at this point in the history
  3. Sorta fix mapping issue:

    For some reason PyMapping_Check returns true for string types, dont know why.
    This probably means I have to to do a subclass check.
    dosisod committed Oct 23, 2022
    Configuration menu
    Copy the full SHA
    3bb2e55 View commit details
    Browse the repository at this point in the history
  4. Switch to using PyDict_Check

    dosisod committed Oct 23, 2022
    Configuration menu
    Copy the full SHA
    59f140e View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    67efc08 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    e57f0a1 View commit details
    Browse the repository at this point in the history
  7. Finish map runtime tests

    dosisod committed Oct 23, 2022
    Configuration menu
    Copy the full SHA
    214dcea View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    ad82d9f View commit details
    Browse the repository at this point in the history
  9. Add basic sequence support

    dosisod committed Oct 23, 2022
    Configuration menu
    Copy the full SHA
    c59c465 View commit details
    Browse the repository at this point in the history
  10. Get unbound sequence capture working at end of list (almost):

    We need to do a check to see that the list is not too short for the number of
    patterns we have. Currently there is a failing test, which will be fixed momentarily.
    dosisod committed Oct 23, 2022
    Configuration menu
    Copy the full SHA
    fc74fa2 View commit details
    Browse the repository at this point in the history
  11. Fix last commit

    dosisod committed Oct 23, 2022
    Configuration menu
    Copy the full SHA
    739962f View commit details
    Browse the repository at this point in the history

Commits on Oct 24, 2022

  1. Updates

    dosisod committed Oct 24, 2022
    Configuration menu
    Copy the full SHA
    0115381 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    38a5cc5 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    04f0cbc View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    360f686 View commit details
    Browse the repository at this point in the history
  5. Cleanups

    dosisod committed Oct 24, 2022
    Configuration menu
    Copy the full SHA
    9714a2c View commit details
    Browse the repository at this point in the history
  6. Renaming

    dosisod committed Oct 24, 2022
    Configuration menu
    Copy the full SHA
    5b70d51 View commit details
    Browse the repository at this point in the history

Commits on Oct 25, 2022

  1. Cleanup

    dosisod committed Oct 25, 2022
    Configuration menu
    Copy the full SHA
    25564c8 View commit details
    Browse the repository at this point in the history
  2. Cleanups

    dosisod committed Oct 25, 2022
    Configuration menu
    Copy the full SHA
    9601a23 View commit details
    Browse the repository at this point in the history
  3. Renames

    dosisod committed Oct 25, 2022
    Configuration menu
    Copy the full SHA
    16e8d12 View commit details
    Browse the repository at this point in the history
  4. Cleanup

    dosisod committed Oct 25, 2022
    Configuration menu
    Copy the full SHA
    b241029 View commit details
    Browse the repository at this point in the history
  5. Cleanups

    dosisod committed Oct 25, 2022
    Configuration menu
    Copy the full SHA
    4b2cfc3 View commit details
    Browse the repository at this point in the history
  6. More cleanups

    dosisod committed Oct 25, 2022
    Configuration menu
    Copy the full SHA
    ede2e14 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    0b30e8b View commit details
    Browse the repository at this point in the history

Commits on Oct 27, 2022

  1. Cleanup

    dosisod committed Oct 27, 2022
    Configuration menu
    Copy the full SHA
    8f0a3bf View commit details
    Browse the repository at this point in the history
  2. Add more tests

    dosisod committed Oct 27, 2022
    Configuration menu
    Copy the full SHA
    96cd6b1 View commit details
    Browse the repository at this point in the history
  3. Black

    dosisod committed Oct 27, 2022
    Configuration menu
    Copy the full SHA
    47f9682 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    532ff8a View commit details
    Browse the repository at this point in the history
  5. Reorganize ops

    dosisod committed Oct 27, 2022
    Configuration menu
    Copy the full SHA
    f73b60a View commit details
    Browse the repository at this point in the history
  6. Isort

    dosisod committed Oct 27, 2022
    Configuration menu
    Copy the full SHA
    b525188 View commit details
    Browse the repository at this point in the history
  7. Merge upstream

    dosisod committed Oct 27, 2022
    Configuration menu
    Copy the full SHA
    e01090c View commit details
    Browse the repository at this point in the history

Commits on Oct 28, 2022

  1. Configuration menu
    Copy the full SHA
    a117794 View commit details
    Browse the repository at this point in the history
  2. Fix build errors:

    Turns out that the `-ffat-lto-objects` flag is only available in GCC, and clang
    will complain if there are any unused optimization flags passed. Adding the
    `-Wno-ignored-optimization-argument` flag seems to fix this.
    dosisod committed Oct 28, 2022
    Configuration menu
    Copy the full SHA
    22c1327 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3836f00 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    4f18437 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    4f218b9 View commit details
    Browse the repository at this point in the history

Commits on Oct 31, 2022

  1. Configuration menu
    Copy the full SHA
    6c5de33 View commit details
    Browse the repository at this point in the history
  2. Remove previously added command-line arguments:

    These lines will be moved to a separate PR so that they can be reviewed
    separately from the `match` stuff going on here.
    dosisod committed Oct 31, 2022
    Configuration menu
    Copy the full SHA
    c8f8c84 View commit details
    Browse the repository at this point in the history
  3. Fix flags not being defined in Python 3.9 and below:

    Since the `Py_TPFLAGS_MAPPING` and `Py_TPFLAGS_SEQUENCE` are specific to the
    new pattern matching feature, they are not defined for Python 3.9 and below.
    Now they are defined if they don't exist, which should fix the issue.
    dosisod committed Oct 31, 2022
    Configuration menu
    Copy the full SHA
    dff0c71 View commit details
    Browse the repository at this point in the history

Commits on Nov 4, 2022

  1. Configuration menu
    Copy the full SHA
    03fab7e View commit details
    Browse the repository at this point in the history

Commits on Nov 5, 2022

  1. Attempt to fix last commit:

    It would appear that 9125155 is now causing issues with the IR tests.
    Reverting that commit seems to fix it, but I cannot seem to remember why I
    added it in the first place, and the build artifacts have long since expired.
    dosisod committed Nov 5, 2022
    Configuration menu
    Copy the full SHA
    07486a0 View commit details
    Browse the repository at this point in the history

Commits on Nov 15, 2022

  1. Configuration menu
    Copy the full SHA
    85ec2d7 View commit details
    Browse the repository at this point in the history
  2. Trigger CI

    dosisod committed Nov 15, 2022
    Configuration menu
    Copy the full SHA
    9728bc6 View commit details
    Browse the repository at this point in the history

Commits on Dec 1, 2022

  1. Configuration menu
    Copy the full SHA
    5bb3e28 View commit details
    Browse the repository at this point in the history
  2. Add review suggestions:

    * Use faster "isinstance" op if the expression is a built-in type
    
    * Add type annotations to run tests
    
    * Add type annotated IR example
    
    * Add todo comments
    dosisod committed Dec 1, 2022
    Configuration menu
    Copy the full SHA
    af5bca8 View commit details
    Browse the repository at this point in the history