Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/IDE/Code Editor/Formatting    [ Add a report in this area ]  
Report #:  85534   Status: Closed
Code formatter fails with if and repeat...until
Project:  Delphi Build #:  14.0.3593.25826
Version:    14.0 Submitted By:   David Wilcockson
Report Type:  Basic functionality failure Date Reported:  6/17/2010 12:57:06 PM
Severity:    Serious / Highly visible problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   277464
Resolution: Cannot Reproduce (Resolution Comments) Resolved in Build: : 15.0.3821.31792
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
The following code:

procedure TForm20.Button1Click(Sender: TObject);
var
   i: integer;
begin
   if 1 = 1 then
      repeat
         Inc(i);
      until i = 10;
end;

When formatter wrongly places the last 'end;':

procedure TForm20.Button1Click(Sender: TObject);
var
   i: integer;
begin
   if 1 = 1 then
      repeat
         Inc(i);
      until i = 10;
   end;


Steps to Reproduce:
procedure TForm20.Button1Click(Sender: TObject);
var
   i: integer;
begin
   if 1 = 1 then
      repeat
         Inc(i);
      until i = 10;
   end;


And press Ctrl+D
Workarounds
Surround the repeat statement in a begin..end:

procedure TForm20.Button1Click(Sender: TObject);
var
   i: integer;
begin
   if 1 = 1 then
     begin
        repeat
           Inc(i);
         until i = 10;
      end;
end;
Attachment
None
Comments

None

Server Response from: ETNACODE01