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

Introduce error category [unsafe-overload] #16061

Merged
merged 6 commits into from
Sep 7, 2023

Conversation

randolf-scholz
Copy link
Contributor

@randolf-scholz randolf-scholz commented Sep 6, 2023

fixes #16060

  • adds codes.UNSAFE_OVERLOAD
  • unsafe overloads now raise [unsafe-overload]
  • added unit test

Notes:

  • Within mypy source code, types/get_proper_types needed a modified type-ignore.

@randolf-scholz
Copy link
Contributor Author

There were ~158 failed tests on local due to mismatch with type: ignore[misc].

@github-actions

This comment has been minimized.

@AlexWaygood
Copy link
Member

AlexWaygood commented Sep 7, 2023

closing and reopening to trigger a new run of mypy_primer; there was a flaky error on the latest run

@AlexWaygood AlexWaygood closed this Sep 7, 2023
@AlexWaygood AlexWaygood reopened this Sep 7, 2023
@github-actions

This comment has been minimized.

@randolf-scholz
Copy link
Contributor Author

randolf-scholz commented Sep 7, 2023

@AlexWaygood Seems like tests pass now. I had to remove again the hyperlink I added to the error message.
Should it stay as is:

f"Overloaded function signatures {index1} and {index2} overlap with incompatible return types"

or is the following better? (would require fixing tests)

f"Overloaded function signatures {index1} and {index2} overlap with incompatible return types."
" See https://mypy.readthedocs.io/en/stable/more_types.html#type-checking-the-variants",

@randolf-scholz randolf-scholz marked this pull request as ready for review September 7, 2023 11:02
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

LGTM. Only projects that have --warn-unused-ignores enabled in their mypy configs will get this error; projects can always switch that option off temporarily if they find this change to be too disruptive:

Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]

I had to remove again the hyperlink I added to the error message.

Having the hyperlink in the error message would be a pretty nice usability improvement, but I can imagine it would require a lot of tests to be updated. I think it would be okay to defer adding the hyperlink to a followup PR. Note though that you can also use pytest --update-data to automate making most of the required updates to mypy's test cases.

mypy/errorcodes.py Outdated Show resolved Hide resolved
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
@github-actions

This comment has been minimized.

mypy/messages.py Outdated Show resolved Hide resolved
@github-actions
Copy link
Contributor

github-actions bot commented Sep 7, 2023

Diff from mypy_primer, showing the effect of this PR on open source code:

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/base.py:1318: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]

mypy (https://github.com/python/mypy)
+ mypy/types.py:3022: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]

steam.py (https://github.com/Gobot1234/steam.py)
- steam/ext/commands/commands.py:931: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
+ steam/ext/commands/commands.py:931: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [unsafe-overload]

aioredis (https://github.com/aio-libs/aioredis)
+ aioredis/utils.py:45: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]

pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
- pandas-stubs/core/strings.pyi:44: error: Overloaded function signatures 2 and 3 overlap with incompatible return types  [misc]
+ pandas-stubs/core/strings.pyi:44: error: Overloaded function signatures 2 and 3 overlap with incompatible return types  [unsafe-overload]
- pandas-stubs/core/series.pyi:162: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:162: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [unsafe-overload]
+ pandas-stubs/core/series.pyi:177: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]
+ pandas-stubs/core/series.pyi:222: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]
+ pandas-stubs/core/series.pyi:235: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]
+ pandas-stubs/core/series.pyi:245: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]
+ pandas-stubs/core/series.pyi:255: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]
- pandas-stubs/core/series.pyi:268: error: Overloaded function signatures 5 and 7 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:268: error: Overloaded function signatures 5 and 7 overlap with incompatible return types  [unsafe-overload]
- pandas-stubs/core/series.pyi:540: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:540: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [unsafe-overload]
- pandas-stubs/core/series.pyi:540: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:540: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [unsafe-overload]
- pandas-stubs/core/series.pyi:540: error: Overloaded function signatures 1 and 4 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:540: error: Overloaded function signatures 1 and 4 overlap with incompatible return types  [unsafe-overload]
- pandas-stubs/core/series.pyi:540: error: Overloaded function signatures 1 and 6 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:540: error: Overloaded function signatures 1 and 6 overlap with incompatible return types  [unsafe-overload]
- pandas-stubs/core/series.pyi:553: error: Overloaded function signatures 2 and 6 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:553: error: Overloaded function signatures 2 and 6 overlap with incompatible return types  [unsafe-overload]
- pandas-stubs/core/series.pyi:566: error: Overloaded function signatures 3 and 6 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:566: error: Overloaded function signatures 3 and 6 overlap with incompatible return types  [unsafe-overload]
- pandas-stubs/core/series.pyi:579: error: Overloaded function signatures 4 and 6 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:579: error: Overloaded function signatures 4 and 6 overlap with incompatible return types  [unsafe-overload]
+ pandas-stubs/core/series.pyi:645: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]
- pandas-stubs/core/series.pyi:671: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:671: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [unsafe-overload]
+ pandas-stubs/core/series.pyi:704: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]
+ pandas-stubs/core/series.pyi:840: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]
- pandas-stubs/core/series.pyi:848: error: Overloaded function signatures 2 and 3 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:848: error: Overloaded function signatures 2 and 3 overlap with incompatible return types  [unsafe-overload]
- pandas-stubs/core/series.pyi:865: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:865: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [unsafe-overload]
- pandas-stubs/core/series.pyi:881: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:881: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [unsafe-overload]
+ pandas-stubs/core/series.pyi:1175: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]
- pandas-stubs/core/series.pyi:1182: error: Overloaded function signatures 2 and 3 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:1182: error: Overloaded function signatures 2 and 3 overlap with incompatible return types  [unsafe-overload]
- pandas-stubs/core/series.pyi:1182: error: Overloaded function signatures 2 and 4 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:1182: error: Overloaded function signatures 2 and 4 overlap with incompatible return types  [unsafe-overload]
- pandas-stubs/core/series.pyi:1182: error: Overloaded function signatures 2 and 5 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:1182: error: Overloaded function signatures 2 and 5 overlap with incompatible return types  [unsafe-overload]
- pandas-stubs/core/series.pyi:1182: error: Overloaded function signatures 2 and 6 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:1182: error: Overloaded function signatures 2 and 6 overlap with incompatible return types  [unsafe-overload]
- pandas-stubs/core/series.pyi:1189: error: Overloaded function signatures 3 and 4 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:1189: error: Overloaded function signatures 3 and 4 overlap with incompatible return types  [unsafe-overload]
- pandas-stubs/core/series.pyi:1189: error: Overloaded function signatures 3 and 5 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:1189: error: Overloaded function signatures 3 and 5 overlap with incompatible return types  [unsafe-overload]
- pandas-stubs/core/series.pyi:1189: error: Overloaded function signatures 3 and 6 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:1189: error: Overloaded function signatures 3 and 6 overlap with incompatible return types  [unsafe-overload]
- pandas-stubs/core/series.pyi:1196: error: Overloaded function signatures 4 and 5 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:1196: error: Overloaded function signatures 4 and 5 overlap with incompatible return types  [unsafe-overload]
- pandas-stubs/core/series.pyi:1196: error: Overloaded function signatures 4 and 6 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:1196: error: Overloaded function signatures 4 and 6 overlap with incompatible return types  [unsafe-overload]
- pandas-stubs/core/series.pyi:1203: error: Overloaded function signatures 5 and 6 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:1203: error: Overloaded function signatures 5 and 6 overlap with incompatible return types  [unsafe-overload]
+ pandas-stubs/core/series.pyi:1466: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]
+ pandas-stubs/core/series.pyi:1498: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]
+ pandas-stubs/core/series.pyi:1509: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]
+ pandas-stubs/core/series.pyi:1523: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]
+ pandas-stubs/core/series.pyi:1532: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]
- pandas-stubs/core/series.pyi:1538: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:1538: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [unsafe-overload]
+ pandas-stubs/core/series.pyi:1556: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]
+ pandas-stubs/core/series.pyi:1924: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]
- pandas-stubs/core/series.pyi:2006: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:2006: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [unsafe-overload]
- pandas-stubs/core/series.pyi:2045: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:2045: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [unsafe-overload]
- pandas-stubs/core/series.pyi:2047: error: Overloaded function signatures 2 and 3 overlap with incompatible return types  [misc]
+ pandas-stubs/core/series.pyi:2047: error: Overloaded function signatures 2 and 3 overlap with incompatible return types  [unsafe-overload]

... (truncated 362 lines) ...

pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/mark/structures.py:344: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]

operator (https://github.com/canonical/operator)
- ops/pebble.py:2163: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
+ ops/pebble.py:2163: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [unsafe-overload]
- ops/model.py:2455: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
+ ops/model.py:2455: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [unsafe-overload]

jax (https://github.com/google/jax)
- jax/_src/numpy/lax_numpy.py:1062: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
+ jax/_src/numpy/lax_numpy.py:1062: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [unsafe-overload]

scrapy (https://github.com/scrapy/scrapy)
+ scrapy/utils/spider.py:37: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]

bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/embed/standalone.py:137: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]
+ src/bokeh/embed/standalone.py:144: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]
+ src/bokeh/embed/standalone.py:151: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]

hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
- src/hydra_zen/typing/_builds_overloads.py:44: error: Overloaded function signatures 1 and 4 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:44: error: Overloaded function signatures 1 and 4 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:44: error: Overloaded function signatures 1 and 5 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:44: error: Overloaded function signatures 1 and 5 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:44: error: Overloaded function signatures 1 and 6 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:44: error: Overloaded function signatures 1 and 6 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:65: error: Overloaded function signatures 2 and 3 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:65: error: Overloaded function signatures 2 and 3 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:65: error: Overloaded function signatures 2 and 5 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:65: error: Overloaded function signatures 2 and 5 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:65: error: Overloaded function signatures 2 and 6 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:65: error: Overloaded function signatures 2 and 6 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:86: error: Overloaded function signatures 3 and 5 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:86: error: Overloaded function signatures 3 and 5 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:86: error: Overloaded function signatures 3 and 6 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:86: error: Overloaded function signatures 3 and 6 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:107: error: Overloaded function signatures 4 and 5 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:107: error: Overloaded function signatures 4 and 5 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:107: error: Overloaded function signatures 4 and 6 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:107: error: Overloaded function signatures 4 and 6 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:129: error: Overloaded function signatures 5 and 8 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:129: error: Overloaded function signatures 5 and 8 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:129: error: Overloaded function signatures 5 and 9 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:129: error: Overloaded function signatures 5 and 9 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:150: error: Overloaded function signatures 6 and 7 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:150: error: Overloaded function signatures 6 and 7 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:150: error: Overloaded function signatures 6 and 9 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:150: error: Overloaded function signatures 6 and 9 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:172: error: Overloaded function signatures 7 and 9 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:172: error: Overloaded function signatures 7 and 9 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:193: error: Overloaded function signatures 8 and 9 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:193: error: Overloaded function signatures 8 and 9 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:270: error: Overloaded function signatures 1 and 5 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:270: error: Overloaded function signatures 1 and 5 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:270: error: Overloaded function signatures 1 and 6 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:270: error: Overloaded function signatures 1 and 6 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:270: error: Overloaded function signatures 1 and 7 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:270: error: Overloaded function signatures 1 and 7 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:290: error: Overloaded function signatures 2 and 6 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:290: error: Overloaded function signatures 2 and 6 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:290: error: Overloaded function signatures 2 and 7 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:290: error: Overloaded function signatures 2 and 7 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:310: error: Overloaded function signatures 3 and 4 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:310: error: Overloaded function signatures 3 and 4 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:310: error: Overloaded function signatures 3 and 6 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:310: error: Overloaded function signatures 3 and 6 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:310: error: Overloaded function signatures 3 and 7 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:310: error: Overloaded function signatures 3 and 7 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:330: error: Overloaded function signatures 4 and 6 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:330: error: Overloaded function signatures 4 and 6 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:330: error: Overloaded function signatures 4 and 7 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:330: error: Overloaded function signatures 4 and 7 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:351: error: Overloaded function signatures 5 and 6 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:351: error: Overloaded function signatures 5 and 6 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:351: error: Overloaded function signatures 5 and 7 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:351: error: Overloaded function signatures 5 and 7 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:373: error: Overloaded function signatures 6 and 9 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:373: error: Overloaded function signatures 6 and 9 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:373: error: Overloaded function signatures 6 and 10 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:373: error: Overloaded function signatures 6 and 10 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:394: error: Overloaded function signatures 7 and 8 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:394: error: Overloaded function signatures 7 and 8 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:394: error: Overloaded function signatures 7 and 10 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:394: error: Overloaded function signatures 7 and 10 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:416: error: Overloaded function signatures 8 and 10 overlap with incompatible return types  [misc]
+ src/hydra_zen/typing/_builds_overloads.py:416: error: Overloaded function signatures 8 and 10 overlap with incompatible return types  [unsafe-overload]
- src/hydra_zen/typing/_builds_overloads.py:437: error: Overloaded function signatures 9 and 10 overlap with incompatible return types  [misc]

... (truncated 43 lines) ...

streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/elements/widgets/multiselect.py:64: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]
+ lib/streamlit/delta_generator.py:430: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]
+ lib/streamlit/delta_generator.py:978: error: Unused "type: ignore" comment, use narrower [unsafe-overload] instead of [misc] code  [unused-ignore]

discord.py (https://github.com/Rapptz/discord.py)
- discord/state.py:1191: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
+ discord/state.py:1191: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [unsafe-overload]
- discord/channel.py:291: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [misc]
+ discord/channel.py:291: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [unsafe-overload]
- discord/channel.py:295: error: Overloaded function signatures 2 and 3 overlap with incompatible return types  [misc]
+ discord/channel.py:295: error: Overloaded function signatures 2 and 3 overlap with incompatible return types  [unsafe-overload]
- discord/channel.py:1351: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [misc]
+ discord/channel.py:1351: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [unsafe-overload]
- discord/channel.py:1355: error: Overloaded function signatures 2 and 3 overlap with incompatible return types  [misc]
+ discord/channel.py:1355: error: Overloaded function signatures 2 and 3 overlap with incompatible return types  [unsafe-overload]
- discord/channel.py:1678: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [misc]
+ discord/channel.py:1678: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [unsafe-overload]
- discord/channel.py:1682: error: Overloaded function signatures 2 and 3 overlap with incompatible return types  [misc]
+ discord/channel.py:1682: error: Overloaded function signatures 2 and 3 overlap with incompatible return types  [unsafe-overload]
- discord/channel.py:1859: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [misc]
+ discord/channel.py:1859: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [unsafe-overload]
- discord/channel.py:1863: error: Overloaded function signatures 2 and 3 overlap with incompatible return types  [misc]
+ discord/channel.py:1863: error: Overloaded function signatures 2 and 3 overlap with incompatible return types  [unsafe-overload]
- discord/channel.py:2378: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [misc]
+ discord/channel.py:2378: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [unsafe-overload]
- discord/channel.py:2382: error: Overloaded function signatures 2 and 3 overlap with incompatible return types  [misc]
+ discord/channel.py:2382: error: Overloaded function signatures 2 and 3 overlap with incompatible return types  [unsafe-overload]
- discord/app_commands/tree.py:577: error: Overloaded function signatures 1 and 4 overlap with incompatible return types  [misc]
+ discord/app_commands/tree.py:577: error: Overloaded function signatures 1 and 4 overlap with incompatible return types  [unsafe-overload]
- discord/app_commands/tree.py:586: error: Overloaded function signatures 2 and 4 overlap with incompatible return types  [misc]
+ discord/app_commands/tree.py:586: error: Overloaded function signatures 2 and 4 overlap with incompatible return types  [unsafe-overload]
- discord/app_commands/tree.py:595: error: Overloaded function signatures 3 and 4 overlap with incompatible return types  [misc]
+ discord/app_commands/tree.py:595: error: Overloaded function signatures 3 and 4 overlap with incompatible return types  [unsafe-overload]
- discord/ext/commands/core.py:1729: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
+ discord/ext/commands/core.py:1729: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [unsafe-overload]
- discord/ext/commands/core.py:1799: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
+ discord/ext/commands/core.py:1799: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [unsafe-overload]

@JelleZijlstra JelleZijlstra merged commit 175c5a5 into python:master Sep 7, 2023
17 checks passed
@randolf-scholz randolf-scholz deleted the unsafe_overload branch September 7, 2023 16:46
@AlexWaygood
Copy link
Member

Ah @randolf-scholz it looks like the docs build is now failing on master because there are no docs for the new error code: https://github.com/python/mypy/actions/runs/6112378542/job/16589719563. It looks like the docs build didn't happen on this PR before it was merged; we should probably run it on every PR nowadays

Would you mind creating a new PR to add some docs to docs/source/error_code_list.rst?

AlexWaygood added a commit to AlexWaygood/mypy that referenced this pull request Sep 7, 2023
- python#16061 added a new error code, but didn't add any docs for the new error code
- Because nothing in the `docs/` directory was modified, the docs CI job didn't run on that PR
- Now the docs build is failing on `master` because we have an error code without any documentation: https://github.com/python/mypy/actions/runs/6112378542/job/16589719563
@hauntsaninja
Copy link
Collaborator

Can we also name this overload-overlap instead? There are cases where this is not unsafe, in fact, a fairly common point of confusion is that this code can be kind of lint-y. I prefer using "unsafe" only for really scary things

hauntsaninja pushed a commit that referenced this pull request Sep 7, 2023
1. #16061 added a new error code, but didn't add any docs for the new
error code
2. Because nothing in the `docs/` directory was modified, the docs CI
job didn't run on that PR
3. Now the docs build is failing on `master` because we have an error
code without any documentation:
https://github.com/python/mypy/actions/runs/6112378542/job/16589719563
hauntsaninja added a commit to hauntsaninja/mypy that referenced this pull request Sep 9, 2023
A new error code was introduced in
python#16061

As per python#16068, we didn't previously
run doc builds on changes to errorcodes.py, causing tests to fail on
master when this was merged.

Renaming the code as per:
python#16061 (comment)
All type ignores should be unsafe, so we should save the unsafe
adjective for things that are really unsafe. As it stands, there are
many cases where overloads overlap somewhat benignly.
hauntsaninja added a commit that referenced this pull request Sep 10, 2023
A new error code was introduced in
#16061

As per #16068, we didn't previously
run doc builds on changes to errorcodes.py, causing tests to fail on
master when this was merged.

Renaming the code as per:
#16061 (comment) All
type ignores should be unsafe, so we should save the unsafe adjective
for things that are really unsafe. As it stands, there are many cases
where overloads overlap somewhat benignly.

Fixes #8656
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.

Introduce error category [unsafe-overload].
4 participants