bug fix issue #21

This commit is contained in:
Бондарев Иван 2015-12-27 11:27:31 +01:00
parent 0f93a9ff18
commit e04cc45970
2 changed files with 14 additions and 0 deletions

9
TestSuite/generics7.pas Normal file
View file

@ -0,0 +1,9 @@
procedure wr<T>(a: array of T);
begin
assert(a[0].ToString()='5');
end;
begin
var a := Arr(1,3,5);
wr(a.Reverse.ToArray);
end.

View file

@ -811,6 +811,11 @@ namespace PascalABCCompiler.TreeRealization
{
if (!DeduceInstanceTypes(formal[i].type, fact[i].type, deduced, nils))
{
if (alone && fact[i].type is delegated_methods && (fact[i].type as delegated_methods).empty_param_method != null)
{
if (DeduceInstanceTypes(formal[i].type, (fact[i].type as delegated_methods).empty_param_method.type, deduced, nils))
continue;
}
if (alone)
throw new SimpleSemanticError(loc, "GENERIC_FUNCTION_{0}_CAN_NOT_BE_CALLED_WITH_THESE_PARAMETERS", func.name);
RestoreLambdasStates(lambda_syntax_nodes.Values.ToList(), saved_lambdas_states);