fix #2243
This commit is contained in:
parent
70c2755ea1
commit
9071a4786a
22
TestSuite/generics40.pas
Normal file
22
TestSuite/generics40.pas
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
var i: integer;
|
||||||
|
type
|
||||||
|
t1<T> = class;
|
||||||
|
|
||||||
|
t0 = class
|
||||||
|
|
||||||
|
public function f1<T>: t1<T> := nil;
|
||||||
|
|
||||||
|
end;
|
||||||
|
t1<T> = class(t0) end;
|
||||||
|
|
||||||
|
procedure p1<T>(q: t1<T>);
|
||||||
|
begin
|
||||||
|
Inc(i);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure p1(q: t0) := p1(q.f1&<byte>);
|
||||||
|
|
||||||
|
begin
|
||||||
|
p1(new t0);
|
||||||
|
assert(i = 1);
|
||||||
|
end.
|
||||||
|
|
@ -2088,7 +2088,18 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
is_alone_method_defined, syntax_tree_visitor.context, loc, syntax_nodes_parameters);
|
is_alone_method_defined, syntax_tree_visitor.context, loc, syntax_nodes_parameters);
|
||||||
if (inst == null)
|
if (inst == null)
|
||||||
{
|
{
|
||||||
set_of_possible_functions.RemoveAt(i);
|
try
|
||||||
|
{
|
||||||
|
inst = generic_convertions.DeduceFunction(func, parameters, true, syntax_tree_visitor.context, loc, syntax_nodes_parameters);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
if (inst == null)
|
||||||
|
set_of_possible_functions.RemoveAt(i);
|
||||||
|
else
|
||||||
|
set_of_possible_functions[i] = inst;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue