Environment data
- Language Server version: Pylance insiders v2022.9.21
- OS and version: Windows 10
- Python version (& distribution if applicable, e.g. Anaconda): 3.10.3
Code Snippet
from typing import NewType, Type, TypeVar
a = 3
b = int
c = type(a)
d = TypeVar('d', bound=int)
e = NewType('e', int)
w = e('0x00f0', base=16)
x = b('0x0034', base=16)
y = c('0x00FF', base=16)
z = d('0x00fe', base=16)
print(x)
print(y)
print(z)
print(w)
Repro Steps
Run mpy against this file. This is the output I get
PS C:\Users\aku91> mypy test.py
test.py:10: error: Unexpected keyword argument "base" for "e"
test.py:10: error: Argument 1 to "e" has incompatible type "str"; expected "int"
test.py:13: error: "object" not callable
Found 3 errors in 1 file (checked 1 source file)
PS C:\Users\aku91>
Expected behavior
Pylance should detect the two problems:
- NewType is used incorrectly
- TypeVar type is not constructable
Logs
pylancelog.log
Environment data
Code Snippet
Repro Steps
Run mpy against this file. This is the output I get
Expected behavior
Pylance should detect the two problems:
Logs
pylancelog.log