This commit is contained in:
Бондарев Иван 2019-10-06 12:38:27 +02:00
parent 85f95b0d05
commit c6b852f373
7 changed files with 50 additions and 20 deletions

View file

@ -9630,10 +9630,11 @@ namespace PascalABCCompiler.NETGenerator
{
is_dot_expr = false;
}
if (init_call_awaited && !value.new_obj_awaited())
if (init_call_awaited && !value.new_obj_awaited() && cnstr.DeclaringType != cur_type)
{
il.Emit(OpCodes.Ldarg_0);
il.Emit(OpCodes.Call, cur_ti.init_meth);
//throw new Exception(cnstr.DeclaringType.Name+"-"+cur_meth.DeclaringType.Name);
init_call_awaited = false;
}
}

View file

@ -9413,7 +9413,7 @@ end;
/// Возвращает индекс последнего минимального элемента
function LastIndexMin<T>(Self: array of T): integer; extensionmethod; where T: System.IComparable<T>;
begin
Result := Self.LastIndexMin(Self.Count - 1);
Result := Self.LastIndexMin(Self.Length - 1);
end;
/// Возвращает индекс последнего минимального элемента в диапазоне [0,index-1]

39
TestSuite/class3.pas Normal file
View file

@ -0,0 +1,39 @@
type
t1=class
public i1 := 1;
public i2 := 2;
public o: object := new Object;
public constructor(i1, i2: integer);
begin
assert(o <> nil);
self.i1 := i1;
self.i2 := i2;
end;
public constructor(i1: integer) :=
Create(i1,6);
end;
t2 = class
a: array of integer := (1, 2, 3);
b: set of char := ['a', 'b', 'c'];
constructor(a: array of integer);
begin
assert('b' in b);
assert(self.a[0] = 1);
self.a := a;
end;
end;
begin
var o1 := new t1(3,4);
var o2 := new t1(5);
assert(o2.i1 = 5);
assert(o2.i2 = 6);
var o3 := new t2(Arr(4, 5, 6));
assert(o3.a[0] = 4);
end.

View file

@ -45,6 +45,7 @@ TestRunner.exe 2
TestRunner.exe 3
TestRunner.exe 4
TestRunner.exe 5
TestRunner.exe 6
cd ..\ReleaseGenerators
call PascalABCNET_ALL.bat

View file

@ -28,6 +28,7 @@ TestRunner.exe 2
TestRunner.exe 3
TestRunner.exe 4
TestRunner.exe 5
TestRunner.exe 6
cd ..
GOTO EXIT

Binary file not shown.

View file

@ -367,8 +367,7 @@ begin
end;
if (ParamCount = 0) or (ParamStr(1) = '5') then
begin
if ParamStr(1) = '5' then
begin
CompileAllRunTests(false, true);
writeln('Tests in 32bit mode compiled successfully');
RunAllTests(false);
@ -377,22 +376,11 @@ begin
CompileAllRunTests(true);
writeln('Tests with pabcrtl compiled successfully');
CompileAllCompilationTests('pabcrtl_tests', true);
RunAllTests(false);
writeln('Tests with pabcrtl run successfully');
end
else
begin
CompileAllRunTests(true);
writeln('Tests with pabcrtl compiled successfully');
CompileAllCompilationTests('pabcrtl_tests', true);
RunAllTests(false);
writeln('Tests with pabcrtl run successfully');
ClearExeDir;
CompileAllRunTests(false, true);
writeln('Tests in 32bit mode compiled successfully');
RunAllTests(false);
writeln('Tests in 32bit run successfully');
end;
end;
if (ParamCount = 0) or (ParamStr(1) = '6') then
begin
RunAllTests(false);
writeln('Tests with pabcrtl run successfully');
System.Environment.CurrentDirectory := Path.GetDirectoryName(GetEXEFileName());
RunExpressionsExtractTests;
writeln('Intellisense expression tests run successfully');