Skip to content

Find references on overloaded/abstract class method #8173

Closed

Description

It would be nice for "Find references" to also report usages of the overloads / implementations of the base method.

Example:

abstract class Base {
    abstract someMethod(): void; // <-- find references here should also find MyClass#someMethod
}

class MyClass extends Base {
    someMethod() {
        alert('test");
    }
}

EDIT: This is also a problem with refactoring (method rename) since it would rename the base class method, but not the overrides in the child classes.

Activity

  1. added
    Needs More Info
    on Apr 19, 2016
  2. RyanCavanaugh commented on Apr 19, 2016

    @RyanCavanaugh
    Member

    Thanks for reporting this. Unfortunately, the code here isn't enough to reproduce the issue you're describing -- the rename and find references successfully find someMethod in both classes regardless of which one I start at.

    Can you reduce this down to an isolated block that shows the bug? Either a sample that clearly shows the problem in the TypeScript Playground would be great.

  3. use-strict commented on Apr 19, 2016

    @use-strict
    Author

    Somehow I assumed this feature wasn't implemented at all and I didn't bother to test my example. It looks like it only happens when generics are involved. See the modified example below:

    abstract class Base<T> {
        abstract someMethod(): T; // <-- find references here should also find MyClass#someMethod
    }
    
    class MyClass<T> extends Base<T> {
        someMethod(): T {
            alert('test');
            return; // funnily, this is also allowed without an explicit cast
        }
    }
  4. added
    Bug
    and removed
    Needs More Info
    on Apr 19, 2016
  5. RyanCavanaugh commented on Apr 19, 2016

    @RyanCavanaugh
    Member

    Re: your comment, see the --noImplicitReturns switch

  6. added a commit that references this issue on Apr 20, 2016
  7. added
    Fixed
    on Apr 20, 2016
  8. added a commit that references this issue on Apr 20, 2016
  9. locked and limited conversation to collaborators on Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugFixed

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions