xsharp.eu • BEGIN/END SEQUENCE causes compiler error XS0136
Page 1 of 1

BEGIN/END SEQUENCE causes compiler error XS0136

Posted: Sat Jun 18, 2022 4:50 pm
by Alf
Hi to all,
after moving to 2.12.2.0 I get this compiler error:

Code: Select all

error XS0136: A local or parameter named 'Xs$Obj' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter
The concerned code line contains: "BEGIN SEQUENCE". Sorry for my stupidity but I don't understand this error message. I guess there are some situations BEGIN/END SEQUENCE is not allowed? How can I solve this? By the way: Same code makes no trouble in earlier X#-Versions (and also not in VO)..
Alf

BEGIN/END SEQUENCE causes compiler error XS0136

Posted: Sat Jun 18, 2022 4:52 pm
by robert
Alf,
The XS$Obj variable is generated by the compiler for RECOVER statements.
DO you have a nested Begin sequence .. end ?
As always: example code helps a lot.

Robert

BEGIN/END SEQUENCE causes compiler error XS0136

Posted: Sun Jun 19, 2022 7:35 am
by Alf
Robert,
your guess is correct: Error XS0136 occurs here:

Code: Select all

BEGIN SEQUENCE
    // Some simple code
RECOVER
    BEGIN SEQUENCE ---> Error XS0136
    // some simple code
    END SEQUENCE
END SEQUENCE
Is this coding no longer allowed in 2.12.2.0?
Alf

BEGIN/END SEQUENCE causes compiler error XS0136

Posted: Sun Jun 19, 2022 3:39 pm
by robert
Alf,
It should be allowed, but is a bit unexpected.
The problem is that the compiler in the current build generates a temporary variable for both sequence blocks with the same name.
I'll change the compiler to make sure that no duplicate names are generated for the next build.
For now I would recommend to replace the inner begin sequence .. end sequence with a

Code: Select all

try 
.. your statements
catch 
   throw
end try
Robert

BEGIN/END SEQUENCE causes compiler error XS0136

Posted: Mon Jun 20, 2022 8:00 am
by Alf
Hi Robert,
thanks for answer and advise.
Alf

BEGIN/END SEQUENCE causes compiler error XS0136

Posted: Mon Jun 20, 2022 8:03 am
by robert