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

"Delete unused variables" doesn't work if a method is named like the variable #222

Closed
ConjuringCoffee opened this issue Dec 14, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@ConjuringCoffee
Copy link
Contributor

Hi Jörg-Michael, I found an issue with the rule "Delete unused variables".

Here's a scenario in which it works correctly.

Before:

REPORT yexample.
CLASS lcl_ DEFINITION CREATE PRIVATE.

  PUBLIC SECTION.
    METHODS test1.

ENDCLASS.


CLASS lcl_ IMPLEMENTATION.
  METHOD test1.
    SELECT
      FROM e071
      FIELDS activity
      INTO TABLE @DATA(test).

    test1( ).
  ENDMETHOD.
ENDCLASS.

After:

REPORT yexample.
CLASS lcl_ DEFINITION CREATE PRIVATE.

  PUBLIC SECTION.
    METHODS test1.
ENDCLASS.


CLASS lcl_ IMPLEMENTATION.
  METHOD test1.
    SELECT
      FROM e071
      FIELDS activity
      " TODO: variable is assigned but never used (ABAP cleaner)
      INTO TABLE @DATA(test).

    test1( ).
  ENDMETHOD.
ENDCLASS.

It doesn't work if the method is named like the variable. This code is unchanged:

REPORT yexample.
CLASS lcl_ DEFINITION CREATE PRIVATE.

  PUBLIC SECTION.
    METHODS test.
ENDCLASS.


CLASS lcl_ IMPLEMENTATION.
  METHOD test.
    SELECT
      FROM e071
      FIELDS activity
      INTO TABLE @DATA(test).

    test( ).
  ENDMETHOD.
ENDCLASS.

Thanks! 🙂

@jmgrassau jmgrassau self-assigned this Dec 30, 2023
@jmgrassau jmgrassau added the bug Something isn't working label Dec 30, 2023
@jmgrassau
Copy link
Member

Hi ConjuringCoffee,

thanks a lot for perfect documentation of this issue! This bug will be fixed with the next release.

Kind regards,
Jörg-Michael

@jmgrassau
Copy link
Member

Hi ConjuringCoffee,

this should now be fixed with version 1.13.0!

Kind regards,
Jörg-Michael

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants