Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Real error location not shown #107

Open
skogsbaer opened this issue May 9, 2022 · 0 comments
Open

Real error location not shown #107

skogsbaer opened this issue May 9, 2022 · 0 comments

Comments

@skogsbaer
Copy link
Owner

skogsbaer commented May 9, 2022

Here is testcase test-data/testTypesDict4.py:

from wypp import *

def foo(d: dict[str, Callable[[], str]]) -> list[str]:
    d['x'] = lambda: 'x' # ok
    res = []
    for k, f in d.items():
        res.append(f())
    return res

def bar(d: dict[str, Callable[[], str]]) -> list[str]:
    return foo(d)

func = lambda: 42
bar({'y': func})  # error

The 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant