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

Variable nodes with nested variables report a parsing error, but work properly in the runtime #4716

Closed
mnojek opened this issue Apr 2, 2023 · 1 comment

Comments

@mnojek
Copy link
Contributor

mnojek commented Apr 2, 2023

Context

We have a rule in Robocop that parses non-local variables and checks if they are written in uppercase. I realized recently (thanks to the MarketSquare/robotframework-robocop#678) that we should exclude nested variables from the check, so that ${VAR${nested}} would not report a rule violation.

The bug

I realized that correct variables are marked with an error by RF Parsing API. For example, this code, run with robot --variable var1:1 test.robot:

*** Variables ***
${var${1}}    1

*** Test Cases ***
My Test
    Log To Console    ${var${1}}

executes with PASS state.

But when parsing the variable node, I see that there is an error there:

Screenshot 2023-04-02 at 20 03 57

The bug appears in RF 5 and 6. I haven't tested for earlier versions.

Here are some more examples that raise the same error for RF Parsing API:

${MY_VAR${var}}  11
${MY VAR${VAR}}  11
${${var}MY VAR${VAR}}  11
${${var${VAR}}MY VAR${VAR}}  11
${@{VAR}[1]MY_VAR&{var.param}}  11
${${var${VAR}}my_var}  11
${${VAR}my_var}  11
${${VAR}my_var${var}}  11
${@{VAR}[1]my_var}  11
${@{VAR}[1]my_var&{var.param}}  11
@pekkaklarck
Copy link
Member

Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants