This commit is contained in:
parent
b13ef78416
commit
3115f470df
29
TestSuite/implicitexplicit26.pas
Normal file
29
TestSuite/implicitexplicit26.pas
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
var i: integer;
|
||||
type
|
||||
t1 = class
|
||||
|
||||
static function operator implicit<T>(val: T): t1;
|
||||
begin
|
||||
i := 1;
|
||||
end;
|
||||
|
||||
static function operator implicit(val: byte): t1;
|
||||
begin
|
||||
i := 2;
|
||||
end;
|
||||
|
||||
static function operator implicit(val: integer): t1;
|
||||
begin
|
||||
i := 3;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
begin
|
||||
var o: t1 := 0;
|
||||
assert(i = 3);
|
||||
o := 2.3;
|
||||
assert(i = 1);
|
||||
o := byte(1);
|
||||
assert(i = 2);
|
||||
end.
|
||||
|
|
@ -2437,7 +2437,20 @@ namespace PascalABCCompiler.TreeRealization
|
|||
if (sil != null)
|
||||
{
|
||||
function_node fn = null;
|
||||
foreach(var si in sil)
|
||||
foreach (var si in sil)
|
||||
{
|
||||
fn = si.sym_info as function_node;
|
||||
if (fn != null && fn.parameters.Count == 1 && type_table.is_type_or_original_generics_equal(fn.parameters[0].type, ctn) && type_table.is_type_or_original_generics_equal(fn.return_value_type, this))
|
||||
{
|
||||
if (!fn.is_generic_function)
|
||||
{
|
||||
if (fn.parameters[0].type.is_generic_parameter && type_table.is_derived(ctn, this))
|
||||
continue;
|
||||
return fn;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (var si in sil)
|
||||
{
|
||||
fn = si.sym_info as function_node;
|
||||
if (fn != null && fn.parameters.Count == 1 && type_table.is_type_or_original_generics_equal(fn.parameters[0].type, ctn) && type_table.is_type_or_original_generics_equal(fn.return_value_type, this))
|
||||
|
|
|
|||
Loading…
Reference in a new issue