Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Fixing issue with decorators with same prefix seen as redefinition #1347

Closed

Conversation

CTrando
Copy link
Contributor

@CTrando CTrando commented Jul 18, 2019

Followed pylint's guide more closely.

ReportRedefinedFunction(fd, existing as PythonType);
break;
// lambdas have the same function name, so don't count them as redefinitions
if (!string.IsNullOrEmpty(fd.Name) && !fd.IsLambda && !IsRedefinedByDecorator(fd)) {
Copy link
Member

@jakebailey jakebailey Jul 22, 2019

Choose a reason for hiding this comment

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

On a second reading, I think it'd be best to do this:

if (existing != null
    && !fd.IsLambda
    && !string.IsNullOrEmpty(fd.Name)
    && !IsRedefinedByDecorator(fd)) {
    switch (existing.MemberType) { }
}

As for the most part, there aren't going to be any redefinitions, and existing will be null. As written now with the switch case's existing? check, the null check happens last, even though it's the most likely.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good insight, I'll add it.

@jakebailey
Copy link
Member

Closing; see #1359.

@jakebailey jakebailey closed this Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants