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

Allow inverting --local-partial-types #18377

Merged
merged 1 commit into from
Dec 30, 2024

Conversation

hauntsaninja
Copy link
Collaborator

Also add it to a bunch of test cases where it is needed

This comment has been minimized.

Also add it to a bunch of test cases where it is needed
Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

# flags: --no-strict-optional
# flags: --no-strict-optional --no-local-partial-types
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making --local-partial-types invertible will certainly help which it's adoption. E.g. we could also consider adding it to --strict as a first step before making it the default in 2.0.

I do just wonder what change made the test diffs necessary. Adding add_invertible_flag with default=False shouldn't change anything, does it?

It will probably make sense to enable it for all our tests by default, but in that case the test config should probably be changed in the same PR. E.g. it could be added here.

mypy/mypy/test/testcheck.py

Lines 128 to 131 in 55d4c17

options = parse_options(original_program_text, testcase, incremental_step)
options.use_builtins_fixtures = True
options.show_traceback = True

--
Feel free to split that up into a different PR if you like though.

Copy link
Collaborator Author

@hauntsaninja hauntsaninja Dec 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, it wasn't necessary, I was just testing that the PR worked by changing the default locally and proactively added it to test cases where I felt confident it was what we needed

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, changing default in tests is not a bad idea

@hauntsaninja hauntsaninja merged commit b2b32e7 into python:master Dec 30, 2024
18 checks passed
@hauntsaninja hauntsaninja deleted the partial-invert branch December 30, 2024 23:52
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