bug fix #1010
This commit is contained in:
parent
4faef09f6a
commit
18a2256b2b
15
TestSuite/overloads9.pas
Normal file
15
TestSuite/overloads9.pas
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
var j: int64;
|
||||||
|
|
||||||
|
procedure test(i: int64; proc:procedure);
|
||||||
|
begin
|
||||||
|
j := i;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure test(r: real; proc:procedure);
|
||||||
|
begin
|
||||||
|
test(System.Convert.ToInt64(r), proc);
|
||||||
|
end;
|
||||||
|
begin
|
||||||
|
test(2.3, nil);
|
||||||
|
assert(j = 2);
|
||||||
|
end.
|
||||||
|
|
@ -2343,6 +2343,25 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
from = (from as delegated_methods).empty_param_method.ret_type;
|
from = (from as delegated_methods).empty_param_method.ret_type;
|
||||||
if (to is delegated_methods && (to as delegated_methods).empty_param_method != null && (to as delegated_methods).empty_param_method.ret_type != null)
|
if (to is delegated_methods && (to as delegated_methods).empty_param_method != null && (to as delegated_methods).empty_param_method.ret_type != null)
|
||||||
to = (to as delegated_methods).empty_param_method.ret_type;
|
to = (to as delegated_methods).empty_param_method.ret_type;
|
||||||
|
internal_interface from_ii = from.get_internal_interface(internal_interface_kind.delegate_interface);
|
||||||
|
internal_interface to_ii = to.get_internal_interface(internal_interface_kind.delegate_interface);
|
||||||
|
if (from_ii != null && to_ii != null)
|
||||||
|
{
|
||||||
|
delegate_internal_interface from_dii = (delegate_internal_interface)from_ii;
|
||||||
|
if (to_ii != null)
|
||||||
|
{
|
||||||
|
delegate_internal_interface to_dii = (delegate_internal_interface)to_ii;
|
||||||
|
if (from_dii.parameters.Count == to_dii.parameters.Count)
|
||||||
|
{
|
||||||
|
bool eq = TreeConverter.convertion_data_and_alghoritms.function_eq_params_and_result(from_dii.invoke_method, to_dii.invoke_method);
|
||||||
|
if (eq)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type_compare tc = type_table.compare_types(from, to);
|
type_compare tc = type_table.compare_types(from, to);
|
||||||
if (tc == type_compare.non_comparable_type)
|
if (tc == type_compare.non_comparable_type)
|
||||||
return 1000;
|
return 1000;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue