bug fix issue #21
This commit is contained in:
parent
0f93a9ff18
commit
e04cc45970
9
TestSuite/generics7.pas
Normal file
9
TestSuite/generics7.pas
Normal 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.
|
||||||
|
|
@ -811,6 +811,11 @@ namespace PascalABCCompiler.TreeRealization
|
||||||
{
|
{
|
||||||
if (!DeduceInstanceTypes(formal[i].type, fact[i].type, deduced, nils))
|
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)
|
if (alone)
|
||||||
throw new SimpleSemanticError(loc, "GENERIC_FUNCTION_{0}_CAN_NOT_BE_CALLED_WITH_THESE_PARAMETERS", func.name);
|
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);
|
RestoreLambdasStates(lambda_syntax_nodes.Values.ToList(), saved_lambdas_states);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue