Skip to content

Add line # of previous definition #3396

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

Merged
merged 3 commits into from
May 22, 2017
Merged

Add line # of previous definition #3396

merged 3 commits into from
May 22, 2017

Conversation

pkch
Copy link
Contributor

@pkch pkch commented May 22, 2017

Partial fix for #1874 - just improve the error message. The duplicate definitions in different if/else branches are still not allowed.

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LG.

mypy/semanal.py Outdated
def name_already_defined(self, name: str, ctx: Context,
original_ctx: Optional[SymbolTableNode] = None) -> None:
if original_ctx:
extra_msg = ' in line {}'.format(original_ctx.node.get_line())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make this "on line {}" ?

@gvanrossum
Copy link
Member

Thanks -- I'll merge once the tests pass!

@gvanrossum gvanrossum merged commit 05521e4 into python:master May 22, 2017
@ilevkivskyi ilevkivskyi mentioned this pull request May 23, 2017
gvanrossum added a commit that referenced this pull request May 23, 2017
JukkaL pushed a commit that referenced this pull request May 23, 2017
Reverts #3396

This caused a new crash, the rollback fixes #3415.
@pkch pkch deleted the dupdef branch May 24, 2017 23:49
JukkaL pushed a commit that referenced this pull request Jun 16, 2017
Partial fix for #1874: improve the error message. The duplicate definitions in 
different if/else branches are still not allowed (this is much harder to fix).
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

Successfully merging this pull request may close these issues.

2 participants