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

Use a separate type variable for unique() #1138

Merged
merged 2 commits into from
Apr 5, 2017

Conversation

gvanrossum
Copy link
Member

@gvanrossum
Copy link
Member Author

@JelleZijlstra This what you meant?

@JelleZijlstra
Copy link
Member

Yes, thanks! I am going to try this out to see if it works properly in all cases (but don't have time right now).

@JelleZijlstra
Copy link
Member

Seems to work:

$ cat ../bin/enumu.py 
import enum

class X(enum.Enum):
    a = 1
    b = 2
reveal_type(enum.unique(X))

@enum.unique
class Y(enum.Enum):
    c = 3
    d = 4
reveal_type(Y)
$ mypy --custom-typeshed-dir . ../bin/enumu.py 
../bin/enumu.py:6: error: Revealed type is 'def (value: Any) -> enumu.X'
../bin/enumu.py:12: error: Revealed type is 'def (value: Any) -> enumu.Y'

@JelleZijlstra JelleZijlstra merged commit f44e461 into master Apr 5, 2017
@JelleZijlstra JelleZijlstra deleted the fix-enum-type-var-for-unique branch April 5, 2017 06:48
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.

2 participants