minor compiler issue
Posted: Fri Nov 27, 2020 2:28 pm
Hello Robert,
the code to reproduce a minor compiler error.
The error sort order is line by line. So the error that variable x is use before declaration comes before the error of the second declaration of x.
In my current project there were some warnings between the errors (so I didn't saw the second error message). So I tried to solve the first one which is only solvable by deleting or rename the second declaration. After some time I did go on with cleaning the other errors. After deleting the redeclaration of x (which was copy/paste stuff) 'magically' the first error has gone.
Maybe the first error message can be ignored if the variable is declared in enclosing scope.
Stefan
the code to reproduce a minor compiler error.
Code: Select all
FUNCTION Start( ) AS VOID
VAR x := ""
x := "Test1"
IF 1==1
x := "Test2" //compiler error 'Cannot use local variable 'x' before it is used
VAR x := "" //redefinition
x := "Test3"
ENDIF
RETURN
In my current project there were some warnings between the errors (so I didn't saw the second error message). So I tried to solve the first one which is only solvable by deleting or rename the second declaration. After some time I did go on with cleaning the other errors. After deleting the redeclaration of x (which was copy/paste stuff) 'magically' the first error has gone.
Maybe the first error message can be ignored if the variable is declared in enclosing scope.
Stefan