-
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
bugSomething isn't workingSomething isn't working
Description
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:
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)
To Reproduce
- Open VSCode
- Insert this code and observe Pylance error:
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]))Additional context
No response
Version
1.1.4
Platform
Windows 11
Code of Conduct
- I agree to follow this project's Code of Conduct.
No Duplicate
- I have checked existing issues to avoid duplicates.
34j
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working