Repository navigation
Associate union notes with their parent error - #22232
Open
zhengguangzhuo wants to merge 1 commit into
Open
zhengguangzhuo wants to merge 1 commit into
zhengguangzhuo wants to merge 1 commit into
Conversation
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: colour (https://github.com/colour-science/colour)
- colour/utilities/array.py:4405: note: Right operand is of type "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]"
- colour/utilities/array.py:4751: note: Right operand is of type "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]"
freqtrade (https://github.com/freqtrade/freqtrade)
- freqtrade/data/converter/orderflow.py:172: note: Both left and right operands are unions
- freqtrade/strategy/strategy_helper.py:105: note: Left operand is of type "str | bytes | date | timedelta | datetime64[Any] | <7 more items>"
- freqtrade/strategy/strategy_helper.py:106: note: Left operand is of type "str | bytes | date | timedelta | datetime64[Any] | <7 more items>"
- freqtrade/data/btanalysis/trade_parallelism.py:151: note: Right operand is of type "int | Any | datetime64[Any] | timedelta64[Any] | float | complex | floating[Any] | complexfloating[Any, Any]"
- freqtrade/data/btanalysis/trade_parallelism.py:151: note: Right operand is of type "str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]"
- freqtrade/data/btanalysis/trade_parallelism.py:156: note: Right operand is of type "int | Any | datetime64[Any] | timedelta64[Any] | float | complex | floating[Any] | complexfloating[Any, Any]"
- freqtrade/data/btanalysis/trade_parallelism.py:156: note: Left operand is of type "str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]"
- freqtrade/util/migrations/migrate_wallet_history.py:153: note: Left operand is of type "int | slice[Any, Any, Any] | ndarray[tuple[int], dtype[numpy.bool[builtins.bool]]]"
- freqtrade/optimize/analysis/lookahead.py:83: note: Left operand is of type "int | slice[Any, Any, Any] | ndarray[tuple[int], dtype[numpy.bool[builtins.bool]]]"
jax (https://github.com/google/jax)
- jax/_src/pallas/mosaic/lowering.py:2175: note: Left operand is of type "int | Squeezed"
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #22230.
The union-operand explanatory note is currently tagged with
operatoreven when it accompanies a different parent error such asarg-type. As a result,type: ignore[arg-type]suppresses the error but leaves the note and a spurious error-code mismatch note.Pass the originating error to the note helpers so the note inherits the parent diagnostic's error code and is suppressed together. Add a regression test using the issue reproducer.
Validation:
uv run --no-project --with-requirements dev-requirements.txt -- python runtests.py check-errorcodes.test check-classes.test selfpassed (135 + 613 tests; 1 expected failure; self-check passed for 347 files).git diff --checkpassed.sum.golang.org.Prepared with assistance from OpenAI Codex; the submitting account holder is responsible for reviewing it.