Here is testcase test-data/testTypesDict4.py:
fromwyppimport*deffoo(d: dict[str, Callable[[], str]]) ->list[str]:
d['x'] =lambda: 'x'# okres= []
fork, find.items():
res.append(f())
returnresdefbar(d: dict[str, Callable[[], str]]) ->list[str]:
returnfoo(d)
func=lambda: 42bar({'y': func}) # errorThe real error location is not shown. The output is:
Traceback (most recent call last):
File "test-data/testTypesDict4.py", line 14, in <module>
bar({'y': func}) # error
File "test-data/testTypesDict4.py", line 11, in bar
return foo(d)
File "test-data/testTypesDict4.py", line 7, in foo
res.append(f())
WyppTypeError: dict is not a dict[str, Callable[[], str]]
given: {'y': <function <lambda> at 0x10b94d090>, 'x': <untypy.impl.callable.TypedCallable object at 0x10b9a2dd0>}
expected: value of type dict[str, Callable[[], str]]
context: foo(d: dict[str, Callable[[], str]]) -> list[str]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
declared at: test-data/testTypesDict4.py:3
caused by: test-data/testTypesDict4.py:11
| return foo(d)
Here is testcase
test-data/testTypesDict4.py:The real error location is not shown. The output is: