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

Error when constant is used to specify variable size #350

Closed
MDagni opened this issue Aug 30, 2024 · 5 comments
Closed

Error when constant is used to specify variable size #350

MDagni opened this issue Aug 30, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@MDagni
Copy link

MDagni commented Aug 30, 2024

Did you know that you can use constants to specify the size of a char typed variable? The following code generates an error in Abap Cleaner:

report ztest.

constants c_size type i value 10.

data lv_text(c_size) type c.

lv_text = '1234567890'.

This is the error:

image

@jmgrassau jmgrassau added the bug Something isn't working label Aug 30, 2024
@jmgrassau
Copy link
Member

Hi Mehmet,

thanks for reporting this bug – this case is indeed not yet considered by the cleanup rule "Make implicit type explicit"!

Kind regards,
Jörg-Michael

@jmgrassau
Copy link
Member

Hi Mehmet,

thanks again – I thought I solved this, but I just realized there are more issues connected to this, therefore keeping it open for now!

Kind regards,
Jörg-Michael

@jmgrassau
Copy link
Member

Hi Mehmet,

okay, with the next release, these issues should now be resolved:

  • "Make implicit type explicit" correctly resolves the implicit types,
  • "Rearrange local declarations" now keeps the CONSTANTS before the TYPES (because they are used there),
  • "Delete unused variables" recognizes that the constants are used and therefore cannot be commented out:

image

Thanks again for reporting this!

Kind regards,
Jörg-Michael

@MDagni
Copy link
Author

MDagni commented Sep 29, 2024

Thank you for solving it quickly 🙂

@jmgrassau
Copy link
Member

Hi Mehmet,

thanks a lot – this should now be fixed in version 1.19.3, which was just released!

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