jspahrsummers / adt

Algebraic data types for Python (experimental, not actively maintained)
MIT License
172 stars 14 forks source link

mypy plugin causes TypeError: list object expected; got tuple w/ mypy==0.812 #42

Closed alexmusa closed 3 years ago

alexmusa commented 3 years ago

It used to work with mypy==0.761 but broke when when upgraded to 0.812

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "mypy/semanal.py", line 4835, in accept
  File "mypy/nodes.py", line 950, in accept
  File "mypy/semanal.py", line 1048, in visit_class_def
  File "mypy/semanal.py", line 1125, in analyze_class
  File "mypy/semanal.py", line 1134, in analyze_class_body_common
  File "mypy/semanal.py", line 1180, in apply_class_plugin_hooks
  File "/usr/local/lib/python3.8/site-packages/adt/mypy_plugin.py", line 187, in _transform_class
    _add_accessor_for_case(context, case)
  File "/usr/local/lib/python3.8/site-packages/adt/mypy_plugin.py", line 269, in _add_accessor_for_case
    return_type=case.accessor_return())
  File "/usr/local/lib/python3.8/site-packages/adt/mypy_plugin.py", line 145, in accessor_return
    return mypy.types.TupleType(
  File "mypy/types.py", line 1373, in __init__
TypeError: list object expected; got tuple[mypy.types.Instance, mypy.types.Instance]
/builds/ad53de79/0/path/to/my/file.py:30: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.812

Using python 3.8.5