This commit is contained in:
parent
286d0ebef7
commit
cbc8a681d9
25
TestSuite/implicitexplicit7.pas
Normal file
25
TestSuite/implicitexplicit7.pas
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
type
|
||||
t1 = class
|
||||
static instance: t1;
|
||||
|
||||
static function operator implicit<T>(val: ^T): t1;
|
||||
begin
|
||||
if instance = nil then
|
||||
instance := new t1;
|
||||
Result := instance;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure p1<T>;
|
||||
begin
|
||||
var i := default(T);
|
||||
var a: t1 := @i;
|
||||
assert(a = t1.instance);
|
||||
end;
|
||||
|
||||
begin
|
||||
var i := 5;
|
||||
var a: t1 := @i;
|
||||
assert(a = t1.instance);
|
||||
p1&<integer>;
|
||||
end.
|
||||
|
|
@ -851,6 +851,8 @@ namespace PascalABCCompiler.TreeRealization
|
|||
if (left.type_special_kind == SemanticTree.type_special_kind.set_type && right == SystemLibrary.SystemLibInitializer.TypedSetType.sym_info
|
||||
|| right.type_special_kind == SemanticTree.type_special_kind.set_type && left == SystemLibrary.SystemLibInitializer.TypedSetType.sym_info)
|
||||
return true;
|
||||
if (left is ref_type_node && right is ref_type_node)
|
||||
return is_type_or_original_generics_equal((left as ref_type_node).pointed_type, (right as ref_type_node).pointed_type);
|
||||
return left == right;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2366,6 +2366,8 @@ namespace PascalABCCompiler.TreeRealization
|
|||
}
|
||||
else if (fn.get_generic_params_list() != null && fn.get_generic_params_list().Count > 0)
|
||||
{
|
||||
if (ctn is ref_type_node)
|
||||
ctn = (ctn as ref_type_node).pointed_type;
|
||||
if (ctn.IsPointer)
|
||||
continue;
|
||||
fn = fn.get_instance(new List<type_node>(new type_node[] { ctn }), true, null);
|
||||
|
|
|
|||
Loading…
Reference in a new issue