|
@@ -363,6 +363,7 @@ type
|
|
Procedure TestAdvRec_DestructorFail;
|
|
Procedure TestAdvRec_DestructorFail;
|
|
Procedure TestAdvRecordInFunction;
|
|
Procedure TestAdvRecordInFunction;
|
|
Procedure TestAdvRecordInAnonFunction;
|
|
Procedure TestAdvRecordInAnonFunction;
|
|
|
|
+ Procedure TestAdvRecordClassOperator;
|
|
end;
|
|
end;
|
|
|
|
|
|
{ TTestProcedureTypeParser }
|
|
{ TTestProcedureTypeParser }
|
|
@@ -2612,6 +2613,7 @@ end;
|
|
procedure TTestRecordTypeParser.TestAdvRecordInFunction;
|
|
procedure TTestRecordTypeParser.TestAdvRecordInFunction;
|
|
|
|
|
|
// Src from bug report 36179
|
|
// Src from bug report 36179
|
|
|
|
+
|
|
Const
|
|
Const
|
|
Src =
|
|
Src =
|
|
'{$mode objfpc}'+sLineBreak+
|
|
'{$mode objfpc}'+sLineBreak+
|
|
@@ -2630,10 +2632,13 @@ Const
|
|
|
|
|
|
begin
|
|
begin
|
|
Source.Text:=Src;
|
|
Source.Text:=Src;
|
|
- ParseModule;
|
|
|
|
|
|
+ ParseModule; // We're just interested in that it parses.
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TTestRecordTypeParser.TestAdvRecordInAnonFunction;
|
|
procedure TTestRecordTypeParser.TestAdvRecordInAnonFunction;
|
|
|
|
+
|
|
|
|
+// Src from bug report 36179, modified to put record in anonymous function - not allowed !
|
|
|
|
+
|
|
Const
|
|
Const
|
|
Src =
|
|
Src =
|
|
'{$mode objfpc}'+sLineBreak+
|
|
'{$mode objfpc}'+sLineBreak+
|
|
@@ -2651,11 +2656,37 @@ Const
|
|
' begin'+sLineBreak+
|
|
' begin'+sLineBreak+
|
|
' end;'+sLineBreak+
|
|
' end;'+sLineBreak+
|
|
'end.';
|
|
'end.';
|
|
|
|
+
|
|
begin
|
|
begin
|
|
Source.Text:=Src;
|
|
Source.Text:=Src;
|
|
AssertException('Advanced records not allowed in anonymous function',EParserError,@ParseModule);
|
|
AssertException('Advanced records not allowed in anonymous function',EParserError,@ParseModule);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TTestRecordTypeParser.TestAdvRecordClassOperator;
|
|
|
|
+
|
|
|
|
+// Source from bug id 36180
|
|
|
|
+
|
|
|
|
+Const
|
|
|
|
+ SRC =
|
|
|
|
+ '{$mode objfpc}'+sLineBreak+
|
|
|
|
+ '{$modeswitch advancedrecords}'+sLineBreak+
|
|
|
|
+ 'program afile;'+sLineBreak+
|
|
|
|
+ 'type'+sLineBreak+
|
|
|
|
+ ' TMyRecord = record'+sLineBreak+
|
|
|
|
+ ' class operator = (a, b: TMyRecord): boolean;'+sLineBreak+
|
|
|
|
+ ' end;'+sLineBreak+
|
|
|
|
+ 'class operator TMyRecord.= (a, b: TMyRecord): boolean;'+sLineBreak+
|
|
|
|
+ 'begin'+sLineBreak+
|
|
|
|
+ ' result := (@a = @b);'+sLineBreak+
|
|
|
|
+ 'end;'+sLineBreak+
|
|
|
|
+ 'begin'+sLineBreak+
|
|
|
|
+ 'end.';
|
|
|
|
+
|
|
|
|
+begin
|
|
|
|
+ Source.Text:=Src;
|
|
|
|
+ ParseModule; // We're just interested in that it parses.
|
|
|
|
+end;
|
|
|
|
+
|
|
{ TBaseTestTypeParser }
|
|
{ TBaseTestTypeParser }
|
|
|
|
|
|
Function TBaseTestTypeParser.ParseType(ASource: String; ATypeClass: TClass;
|
|
Function TBaseTestTypeParser.ParseType(ASource: String; ATypeClass: TClass;
|