VSCode's Pylance reports errors when trying to use the example from the package docs. When using the generic function type syntax: TArray: Array, we get type errors on numpy arrays:
Argument of type "NDArray[Any]" cannot be assigned to parameter "x" of type "TArray@generic" in function "generic"
Type "NDArray[Any]" is not assignable to type "Array[Unknown, Unknown]"
"ndarray[_Shape, dtype[Any]]" is incompatible with protocol "Array[Unknown, Unknown]"
"Array[TDtype@Array, TDevice@Array]" is not assignable to "ndarray[_Shape, dtype[Any]]"
"Array[TDtype@Array, TDevice@Array]" is not assignable to "ndarray[_Shape, dtype[Any]]"
"Array[TDtype@Array, TDevice@Array]" is not assignable to "ndarray[_Shape, dtype[Any]]"
"Array[TDtype@Array, TDevice@Array]" is not assignable to "ndarray[_Shape, dtype[Any]]"
"Array[TDtype@Array, TDevice@Array]" is not assignable to "ndarray[_Shape, dtype[Any]]"
"Array[TDtype@Array, TDevice@Array]" is not assignable to "ndarray[_Shape, dtype[Any]]"
...Pylance[reportArgumentType](https://github.com/microsoft/pylance-release/blob/main/docs/diagnostics/reportArgumentType.md)
import numpy as np
from array_api._2024_12 import Array
def generic[TArray: Array](x: TArray) -> TArray:
return x + 1
b = generic(np.array([1, 2, 3]))
Describe the bug
VSCode's Pylance reports errors when trying to use the example from the package docs. When using the generic function type syntax:
TArray: Array, we get type errors on numpy arrays:To Reproduce
Additional context
No response
Version
1.1.4
Platform
Windows 11
Code of Conduct
No Duplicate