openroberta-lab icon indicating copy to clipboard operation
openroberta-lab copied to clipboard

Variables can be used out-of-scope without triggering an error when generating the code

Open PamoCurtis opened this issue 4 years ago • 1 comments

Problem

  • Initializing/declaring variables through for-, foreach- and function-blocks and using the "set 'variable' to"-block out of scope, does not trigger an error when opening the codeview/simulation/sourceCodeEditor (pic 1&2).
  • Initializing/declaring variables like above but then deleting the block lets you use the variables even though they are never initialized/declared (pic 3)
  • It is also possible to use the variable-block after the initialization or in another function. In both cases the variables are out of scope (pic 4)
  • It is even possible to run the code and debug it (pic 2).
  • The code that is generated is faulty

Expected behavior

  • Triggering anything that generates the code, the codeview/simulation/sourceCodeEditor should not be opened and an error message should appear like in picture 5 (picture is from the open-roberta lab)

Screenshots

PIC 1 Bildschirmfoto von 2021-07-08 15-34-04

PIC 2 Bildschirmfoto von 2021-07-08 15-35-09

PIC 3 Bildschirmfoto von 2021-07-08 16-27-08

PIC 4 Bildschirmfoto von 2021-07-08 16-37-02

PIC 5 Bildschirmfoto von 2021-07-08 15-43-22

PamoCurtis avatar Jul 08 '21 14:07 PamoCurtis

Bug is still present in the lab and test/dev

PamoCurtis avatar May 04 '22 08:05 PamoCurtis

Almost all issues* listed in the description seem to be resolved after testing on test server.

*For issue listed in pic 3 above, the set var block still remains in the program after removing the corresponding block that initialises the var. This issue is tracked in #1233.

RaghuvirShirodkar avatar Mar 03 '23 07:03 RaghuvirShirodkar

#1233 is solved, too

bjost2s avatar Mar 08 '23 16:03 bjost2s