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

UnnecessaryInnerClass: fix false positives labeled expression to outer class #4865

Merged
merged 2 commits into from May 29, 2022
Merged

UnnecessaryInnerClass: fix false positives labeled expression to outer class #4865

merged 2 commits into from May 29, 2022

Commits on May 26, 2022

  1. UnnecessaryInnerClass: fix false positives labeled expression to oute…

    …r class
    
    Fix an issue where inner classes which reference their outer class via a labeled
    expression would still be reported as unnecessary. This seems to be due to a
    missing visitExpressionWithLabel() check which resolves the label name: if the
    label is referencing a parent class, then the nested class must be `inner`.
    
    I wasn't able to find a way to resolve the labeled expression as a ClassId to
    match the existing class check from KtReferenceExpression, so I settled for
    using the class name instead, which is easy to obtain. This means there's a fair
    bit of duplication in overriden checkForOuterUsage() methods to check parent
    classes which could probably be removed, but I didn't see a particularly clean
    way to do so.
    dzirbel committed May 26, 2022
    Copy the full SHA
    436cb9d View commit details
    Browse the repository at this point in the history

Commits on May 28, 2022

  1. Copy the full SHA
    71393c3 View commit details
    Browse the repository at this point in the history