KEMBAR78
Add line # of previous definition by pkch · Pull Request #3396 · python/mypy · GitHub
Skip to content

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