Skip to content

Conversation

@pkch
Copy link
Contributor

@pkch pkch commented May 23, 2017

Fix #3415
Sorry, I meant to check for .node is None, but forgot.

Please check if the message is ok in case the line info unavailable.

original_ctx: Optional[SymbolTableNode] = None) -> None:
if original_ctx:
extra_msg = ' on line {}'.format(original_ctx.node.get_line())
if original_ctx.node and original_ctx.node.get_line() != -1:
Copy link
Member

Choose a reason for hiding this comment

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

IIUC the idea, then I would check for original_ctx.mod_id, and if it is not None then mention the module where original definition occurred. Otherwise, I would just set extra_msg = ''.

Copy link
Member

Choose a reason for hiding this comment

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

(This comment belongs to the else: branch below.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We're trying to catch the cases where the definition is repeated twice in the same module, and indicate the line where the first one occurred. I don't think mod_id would ever be a different module if it gets to this line, right? It could be either None (when the definition was added from an import perhaps) or the same as the current module.

@pkch
Copy link
Contributor Author

pkch commented May 23, 2017

Closing this in favor of resubmitting the original PR.

@pkch pkch closed this May 23, 2017
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