Describe the bug
Parameters of Collection type don't seem to be type checked correctly.
To Reproduce
See the code snippet below.
Expected behavior
A message indicating the issue.
Screenshots or Code
from datetime import date
from typing import AnyStr, Collection, Iterable, List
def test_iterable1(c: Iterable[AnyStr]):
pass
def test_iterable2(c: Iterable[int]):
pass
def test_collection1(c: Collection[AnyStr]):
pass
def test_collection2(c: Collection[int]):
pass
def test_list1(l: List[AnyStr]):
pass
def test_list2(l: List[int]):
pass
dates = [date(2020, 1, 1)]
strs = ['s']
test_iterable1(dates) # highlighted correctly
test_iterable2(strs) # highlighted correctly
test_collection1(dates) # not highlighted
test_collection1(strs) # not highlighted
test_collection2(dates) # not highlighted
test_collection2(strs) # not highlighted
test_list1(dates) # highlighted correctly
test_list1(strs) # highlighted correctly
test_list2(dates) # highlighted correctly
test_list2(strs) # highlighted correctly
VS Code extension or command-line
pyright (1.1.22) is being run as a VS Code extension.
Additional context
Add any other context about the problem here.
Thanks for the bug report. The problem is that Pyright isn't correctly handling protocol classes that derive from other protocol classes. Collection is an example. I'll work on a fix.
This will be fixed in the next published version of Pyright.
This is included in 1.1.23, which I just published.