Skip to content

Catch incomplete TypeVisitor implementations #733

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

Closed
wants to merge 8 commits into from

Conversation

JamesGuthrie
Copy link
Contributor

Use the @abstractmethod decorator on abstract methods. Part of #730

This breaks all tests as the @abstractmethod raises a runtime exception on instantiation of a subclass with unimplemented abstract methods. We need to provide complete implementations for these in order to get the tests to pass.

Subclasses with incomplete implementations are:

EraseTypeVisitor (mypy/erasetype.py: 26)
    visit_ellipsis_type()
    visit_star_type()

SameTypeVisitor(mypy/sametype.py: 29)
    visit_overloaded()
    visit_ellipsis_type()
    visit_star_type()

ExpandTypeVisitor(mypy/expandtype.py: 35)
    visit_ellipsis_type()
    visit_star_type()

SubtypeVisitor(mypy/subtypes.py: 44)
    visit_ellipsis_type()
    visit_star_type()

TypeAnalyser(mypy/typeanal.py: 58)
    visit_error_type()
    visit_overloaded()
    visit_ellipsis_type()
    visit_star_type()

TypeJoinVisitor(mypy/join.py: 70)
    visit_overloaded()
    visit_ellipsis_type()
    visit_star_type()

TypeMeetVisitor(mypy/meet.py: 77)
    visit_ellipsis_type()
    visit_star_type()

ConstraintBuilderVisitor(mypy/constraints.py: 125)
    visit_error_type()
    visit_overloaded()
    visit_ellipsis_type()
    visit_star_type()
    visit_type_list()

TypeQuery(mypy/types.py: 760)
    visit_overloaded()
    visit_ellipsis_type()

subclasses of TypeQuery:
    HasAnyQuery(mypy/stats.py: 223)
    HasAnyQuery2(mypy/stats.py: 241)
    ArgInferSecondpassQuery(mypy/checkexpr.py: 1375)
    HasTypeVarQuery(mypy/checkexpr.py: 1389)
    HasErasedComponentsQuery(mypy/checkexpr.py: 1402)

TypeAnalyserPass3(mypy/typeanal.py: 234)
    visit_error_type()
    visit_overloaded()
    visit_ellipsis_type()
    visit_star_type()
    visit_type_list()

@JukkaL
Copy link
Collaborator

JukkaL commented Aug 6, 2015

Thanks for the PR! We'll need to provide the missing implementations before merging this to master so that tests will pass. If you are not working on that, I can do it, maybe this weekend. Just want to make sure that there's no duplicate work.

@JamesGuthrie
Copy link
Contributor Author

I'm not working on the missing implementations, it looks like it would require a much better understanding of mypy's model of the type system than I have...

@JamesGuthrie JamesGuthrie force-pushed the github-730 branch 2 times, most recently from b3bb5c2 to 749bb56 Compare August 24, 2015 16:40
@JamesGuthrie
Copy link
Contributor Author

@JukkaL glad to see you're back. As I mentioned in #730, this can actually be merged as-is. It doesn't fix #730 completely yet, but it does improve the situation.

@JukkaL
Copy link
Collaborator

JukkaL commented Oct 17, 2015

Sorry, I had missed the update, thanks! I manually rebased this to master (github isn't clever enough to notice that it's in).

@JukkaL JukkaL closed this Oct 17, 2015
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