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

Basic ParamSpec Concatenate and literal support #11847

Merged
merged 50 commits into from
Apr 7, 2022

Commits on Dec 24, 2021

  1. Add ParamSpec literals

    A5rocks committed Dec 24, 2021
    Configuration menu
    Copy the full SHA
    ef32680 View commit details
    Browse the repository at this point in the history

Commits on Dec 25, 2021

  1. Improve ParamSpec and Parameters checking

    Now this program works:
    ```py
    from typing_extensions import ParamSpec
    from typing import Generic, Callable
    
    P = ParamSpec("P")
    
    class Z(Generic[P]):
    	def call(self, *args: P.args, **kwargs: P.kwargs) -> None:
    		pass
    
    n: Z[[int]]
    
    reveal_type(n)  # N: Revealed type is "repro.Z[[builtins.int]]"
    
    def f(n: Z[P]) -> Z[P]:
    	...
    
    reveal_type(f)  # N: Revealed type is "def [P] (n: repro.Z[P`-1]) -> repro.Z[P`-1]"
    reveal_type(f(n))  # N: Revealed type is "repro.Z[[builtins.int]]"
    ```
    A5rocks committed Dec 25, 2021
    Configuration menu
    Copy the full SHA
    816f3cd View commit details
    Browse the repository at this point in the history

Commits on Dec 26, 2021

  1. Get basic Concatenate features working

    This program:
    ```py
    from typing_extensions import ParamSpec, Concatenate
    from typing import Generic
    
    P = ParamSpec("P")
    
    class Z(Generic[P]): ...
    
    n: Z[[int]]
    
    reveal_type(n)
    
    def f(n: Z[P]) -> Z[Concatenate[bool, Concatenate[str, P]]]: ...
    
    reveal_type(f)
    reveal_type(f(n))
    ```
    
    outputs:
    ```
    repro.py:10: note: Revealed type is "repro.Z[[builtins.int]]"
    repro.py:14: note: Revealed type is "def [P] (n: repro.Z[P`-1]) -> repro.Z[Concatenate[builtins.bool, builtins.str, P`-1]]"
    repro.py:15: note: Revealed type is "repro.Z[[builtins.bool, builtins.str, builtins.int]]"
    ```
    
    Next up: checking inputs match prefixes and why does it only work when
    cache exists?
    A5rocks committed Dec 26, 2021
    Configuration menu
    Copy the full SHA
    d9b352f View commit details
    Browse the repository at this point in the history
  2. Fix "cache" bug

    It wasn't actually cache...
    A5rocks committed Dec 26, 2021
    Configuration menu
    Copy the full SHA
    58e6dbe View commit details
    Browse the repository at this point in the history
  3. Check Concatenate prefixes

    A5rocks committed Dec 26, 2021
    Configuration menu
    Copy the full SHA
    51ba4ea View commit details
    Browse the repository at this point in the history
  4. Polish work

    A5rocks committed Dec 26, 2021
    Configuration menu
    Copy the full SHA
    24432ee View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    c507152 View commit details
    Browse the repository at this point in the history
  6. Tests for literals

    A5rocks committed Dec 26, 2021
    Configuration menu
    Copy the full SHA
    d202d1e View commit details
    Browse the repository at this point in the history
  7. Tests for Concatenate

    A5rocks committed Dec 26, 2021
    Configuration menu
    Copy the full SHA
    9ed9830 View commit details
    Browse the repository at this point in the history
  8. Appease CI

    A5rocks committed Dec 26, 2021
    Configuration menu
    Copy the full SHA
    3ffc343 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    ae8ac73 View commit details
    Browse the repository at this point in the history

Commits on Dec 27, 2021

  1. Improve literal TODOs

    A5rocks committed Dec 27, 2021
    Configuration menu
    Copy the full SHA
    9c849cc View commit details
    Browse the repository at this point in the history

Commits on Dec 28, 2021

  1. Add more tests

    A5rocks committed Dec 28, 2021
    Configuration menu
    Copy the full SHA
    d9dcc76 View commit details
    Browse the repository at this point in the history
  2. Allow TypeVars in Concatenate

    A5rocks committed Dec 28, 2021
    Configuration menu
    Copy the full SHA
    0e2b207 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    bd445e5 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    604c304 View commit details
    Browse the repository at this point in the history
  5. Fix tests

    A5rocks committed Dec 28, 2021
    Configuration menu
    Copy the full SHA
    f8004ec View commit details
    Browse the repository at this point in the history

Commits on Dec 29, 2021

  1. Misc changes

    A5rocks committed Dec 29, 2021
    Configuration menu
    Copy the full SHA
    9e75481 View commit details
    Browse the repository at this point in the history

Commits on Jan 1, 2022

  1. Solve with self types

    A5rocks committed Jan 1, 2022
    Configuration menu
    Copy the full SHA
    7b89f06 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f24cf4f View commit details
    Browse the repository at this point in the history

Commits on Jan 3, 2022

  1. Configuration menu
    Copy the full SHA
    472b20c View commit details
    Browse the repository at this point in the history
  2. Ellipsis paramspec literals

    A5rocks committed Jan 3, 2022
    Configuration menu
    Copy the full SHA
    14ecfb9 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5e0ae49 View commit details
    Browse the repository at this point in the history
  4. Appease flake8

    A5rocks committed Jan 3, 2022
    Configuration menu
    Copy the full SHA
    45c8057 View commit details
    Browse the repository at this point in the history

Commits on Jan 7, 2022

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

Commits on Jan 9, 2022

  1. Minor code cleanup

    A5rocks committed Jan 9, 2022
    Configuration menu
    Copy the full SHA
    c46feec View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6a9cd71 View commit details
    Browse the repository at this point in the history
  3. Appease CI

    A5rocks committed Jan 9, 2022
    Configuration menu
    Copy the full SHA
    afc1a57 View commit details
    Browse the repository at this point in the history

Commits on Jan 19, 2022

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

Commits on Jan 27, 2022

  1. Fix something I assumed incorrectly

    I ran into this while testing an interface with ParamSpec :(
    A5rocks committed Jan 27, 2022
    Configuration menu
    Copy the full SHA
    86e23c2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3f4cf5c View commit details
    Browse the repository at this point in the history

Commits on Jan 29, 2022

  1. Revert "Minor code cleanup"

    This reverts commit c46feec.
    
    This commit caused bugs for some reason....
    A5rocks committed Jan 29, 2022
    Configuration menu
    Copy the full SHA
    61b00cd View commit details
    Browse the repository at this point in the history

Commits on Mar 1, 2022

  1. Configuration menu
    Copy the full SHA
    9c2cefd View commit details
    Browse the repository at this point in the history
  2. Fixed raised bugs

    Main things left:
     - Concatenate with mypy_extensions args
     - Flag for non-strict Concatenate
    A5rocks committed Mar 1, 2022
    Configuration menu
    Copy the full SHA
    a44937b View commit details
    Browse the repository at this point in the history
  3. Fix CI errors

    A5rocks committed Mar 1, 2022
    Configuration menu
    Copy the full SHA
    bbabbf1 View commit details
    Browse the repository at this point in the history

Commits on Mar 5, 2022

  1. Squash some more bugs

    Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
    A5rocks and cdce8p committed Mar 5, 2022
    Configuration menu
    Copy the full SHA
    ddfd34a View commit details
    Browse the repository at this point in the history
  2. Concatenate flag

    Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
    A5rocks and cdce8p committed Mar 5, 2022
    Configuration menu
    Copy the full SHA
    2d54ac4 View commit details
    Browse the repository at this point in the history
  3. Prepare for GitHub Actions

    A5rocks committed Mar 5, 2022
    Configuration menu
    Copy the full SHA
    bba91e5 View commit details
    Browse the repository at this point in the history

Commits on Mar 7, 2022

  1. Configuration menu
    Copy the full SHA
    e0a7663 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0363803 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    278b8c4 View commit details
    Browse the repository at this point in the history
  4. Add variance to paramspecs

    This is required to allow positional arguments to be replaced with named
    arguments.
    A5rocks committed Mar 7, 2022
    Configuration menu
    Copy the full SHA
    c2b7628 View commit details
    Browse the repository at this point in the history

Commits on Mar 10, 2022

  1. Apply suggestions from code review

    Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
    A5rocks and cdce8p authored Mar 10, 2022
    Configuration menu
    Copy the full SHA
    0b1fdfb View commit details
    Browse the repository at this point in the history
  2. Update tests

    A5rocks committed Mar 10, 2022
    Configuration menu
    Copy the full SHA
    0fff609 View commit details
    Browse the repository at this point in the history

Commits on Mar 25, 2022

  1. Some of the PR feedback

    A5rocks committed Mar 25, 2022
    Configuration menu
    Copy the full SHA
    4475515 View commit details
    Browse the repository at this point in the history

Commits on Mar 26, 2022

  1. Configuration menu
    Copy the full SHA
    0091762 View commit details
    Browse the repository at this point in the history
  2. Prepare for GitHub actions

    A5rocks committed Mar 26, 2022
    Configuration menu
    Copy the full SHA
    81994f1 View commit details
    Browse the repository at this point in the history

Commits on Apr 5, 2022

  1. Configuration menu
    Copy the full SHA
    1ff96c1 View commit details
    Browse the repository at this point in the history
  2. Fix tests to latest output

    Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
    A5rocks and cdce8p committed Apr 5, 2022
    Configuration menu
    Copy the full SHA
    c79918e View commit details
    Browse the repository at this point in the history
  3. Copy pyright's representation of Concatenate

    pros:
     - more readable IMO
     - more concise
     - standardization of output
    
    cons:
     - can be easy to miss double backets
     - I feel like this is a small deviation from normal mypy
       representations... but I have nothing to back that up.
    
    Overall, I think it's a good thing to try at least.
    A5rocks committed Apr 5, 2022
    Configuration menu
    Copy the full SHA
    9b1fc75 View commit details
    Browse the repository at this point in the history