Skip to content

error in argument when using chained function-call #5311

Open
@z33ky

Description

@z33ky

Example:

dct = {"": ""}

# ok
trans = str.maketrans(dct)
"".translate(trans)

# err
"".translate(str.maketrans(dct))
  • What is the actual behavior/output?

maketrans.py:8: error: Argument 1 to "maketrans" of "str" has incompatible type "Dict[str, str]"; expected "Union[Dict[int, Union[int, str, None]], Dict[str, Union[int, str, None]], Dict[Union[str, int], Union[int, str, None]]]"

  • What is the behavior/output you expect?

No error.

  • What are the versions of mypy and Python you are using?

I tested both mypy 0.610 and mypy 0.620+dev-0ca6bf9ce63439a1e8bcc4dec80ef12f8414cb87 with Python 3.6.5; behavior is identical.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions