Closed as not planned
Description
Bug description
Using a NewType that is an integer and performing an unary operation will incorrectly show the invalid-unary-operand-type
error.
Trying to use it to index an array will report invalid-sequence-index
.
Trying to call a method of int
on an int
NewType will report no-member
.
I haven't tested it, but the same would probably apply at floats.
In the example below, i32
is defined as:
T = TypeVar('T')
@dataclass
class ValueRange(Generic[T]):
min: T
max: T
i32 = NewType('i32', Annotated[int, ValueRange(-2_147_483_648, 2_147_483_647)])
Configuration
No response
Command used
pylint package_name
Pylint output
************* Module skytemple_files.graphics.kao._writer
skytemple_files/graphics/kao/_writer.py:77:43: E1130: bad operand type for unary -: i32 (invalid-unary-operand-type)
skytemple_files/graphics/kao/_writer.py:90:31: E1130: bad operand type for unary -: i32 (invalid-unary-operand-type)
************* Module skytemple_files.patch.handler.expand_poke_list
skytemple_files/patch/handler/expand_poke_list.py:232:16: E1126: Sequence index is not an int, slice, or instance with __index__ (invalid-sequence-index)
skytemple_files/patch/handler/expand_poke_list.py:239:16: E1126: Sequence index is not an int, slice, or instance with __index__ (invalid-sequence-index)
skytemple_files/patch/handler/expand_poke_list.py:246:16: E1126: Sequence index is not an int, slice, or instance with __index__ (invalid-sequence-index)
skytemple_files/patch/handler/expand_poke_list.py:247:16: E1126: Sequence index is not an int, slice, or instance with __index__ (invalid-sequence-index)
************* Module skytemple_files.compression_container._prviate.bma_collision_rle._pymodel
skytemple_files/compression_container/_prviate/bma_collision_rle/_pymodel.py:40:17: E1101: Instance of 'u16' has no 'to_bytes' member (no-member)
Expected behavior
I would expect no error to be reported.
Pylint version
pylint 2.13.9
astroid 2.11.5
Python 3.10.4 (main, Mar 23 2022, 23:05:40) [GCC 11.2.0]
OS / Environment
No response
Additional dependencies
No response