Исправлены проверки в Tasks1Loops.pas

This commit is contained in:
Mikhalkovich Stanislav 2023-08-01 11:12:02 +03:00
parent f355a9cd9d
commit 03cb6d5636
3 changed files with 20 additions and 8 deletions

View file

@ -19,7 +19,7 @@ begin
GenerateTests(10, tInt(1,10) * n);
var m := MatrByRow(3,4,IntArr(n));
CheckOutput(m.Row(1).Max,m.Col(2).Min,m.Col(3).Sum);
CheckOutputSeq(m.ElementsByRow + |m.Row(1).Max,m.Col(2).Min,m.Col(3).Sum|);
end;
end;
end;

View file

@ -601,11 +601,11 @@ namespace PascalABCCompiler.TreeRealization
// Тут можно проверить на ковариантность
// еще где то надо проверять, что IEnumerable<Derived> -> IEnumerable<Base>, но здесь base_class предполагает,
// что это - класс, и рассматривает все его интерфейсы, упуская ситуацию, когда base_class - это и есть интерфейс
else if ((cgitn != null || ctn != null) && (bcgitn != null || bcctn != null)) // SSM 19/04
//else if (cgitn != null && (bcgitn != null || bcctn != null))
//else if ((cgitn != null || ctn != null) && bcgitn != null)
//else if (cgitn != null && bcgitn != null)
//else if (cgitn != null && bcgitn != null || ctn != null && bcctn != null) // SSM 18/04 немного большие ограничения
else if ((cgitn != null || ctn != null) && (bcgitn != null || bcctn != null)) // SSM 19/04
{
compiled_type_node interf_original_generic = cgitn != null ? cgitn.original_generic as compiled_type_node : ctn.original_generic as compiled_type_node;
compiled_type_node base_original_generic = bcgitn != null ? bcgitn.original_generic as compiled_type_node : bcctn.original_generic as compiled_type_node;
@ -637,7 +637,7 @@ namespace PascalABCCompiler.TreeRealization
// ctcgi.compiled_type - это System.Type
if ((interf_compiled_type.GetGenericArguments()[i].GenericParameterAttributes & System.Reflection.GenericParameterAttributes.Covariant) != 0)
{
if (is_derived(base_instance_params[i], interf_instance_params[i], false))
if (is_derived(base_instance_params[i], interf_instance_params[i], false)) // is_derived(object , T, false) = true, что неверно - T - не наследник object!!!
{
// OK
}

View file

@ -544,9 +544,15 @@ begin
CheckOutput(3 in InputListAsIntegers);
end;
'Break2': begin
TestCount := 3;
GenerateTestData := tnum -> begin
case tnum of
1: InputList.AddTestData(|1,2,8,4,5,6,7,1,2,9|);
2: InputList.AddTestData(|1,1,3|);
3: InputList.AddTestData(|7,6,4,3|);
end;
end;
var n := 10;
CheckData(Input := |cInt|*n);
GenerateTests(20,tInt(1,10)*n);
var f := false;
for var i:=0 to n-1 do
begin
@ -561,9 +567,15 @@ begin
end;
'Break3': begin
var n := 10;
CheckData(Input := |cInt|*n);
GenerateTests(10,tInt(0,10)*n);
var f := -1;
TestCount := 3;
GenerateTestData := tnum -> begin
case tnum of
1: InputList.AddTestData(|1,2,3,4,5,6,7,1,2,3|);
2: InputList.AddTestData(|1,1,9|);
3: InputList.AddTestData(|7,6,8|);
end;
end;
var f := 0;
for var i:=0 to n-1 do
begin
var x := Int(i);