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

Improve error message for bad indexed assignment #8608

Closed
JukkaL opened this issue Mar 31, 2020 · 5 comments · Fixed by #8641
Closed

Improve error message for bad indexed assignment #8608

JukkaL opened this issue Mar 31, 2020 · 5 comments · Fixed by #8641

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Mar 31, 2020

The error message generated for this fragment is not very informative:

from typing import Optional, List

def f(d: Optional[List[int]]) -> None:
    d[0] = 1  # Unsupported target for indexed assignment

It would be better to include the type in the message, such as like this:

t.py:4: error: Unsupported target for indexed assignment ("Optional[List[int]]")

#2900 is related, but this issue is more general.

@ndjman7
Copy link
Contributor

ndjman7 commented Apr 2, 2020

May I try this? I want to this issue. @JukkaL

@JukkaL
Copy link
Collaborator Author

JukkaL commented Apr 2, 2020

@ndjman7 Sure, go ahead!

@akerami
Copy link
Contributor

akerami commented Apr 4, 2020

@ndjman7 how is your progress on this? Are you still working on it?

@ndjman7
Copy link
Contributor

ndjman7 commented Apr 5, 2020

@akerami sure. I'm working on it.

ndjman7 added a commit to ndjman7/mypy that referenced this issue Apr 6, 2020
ndjman7 added a commit to ndjman7/mypy that referenced this issue Apr 6, 2020
@ndjman7
Copy link
Contributor

ndjman7 commented Apr 8, 2020

@JukkaL Please review the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants