bug fix #2303
This commit is contained in:
parent
48a68a32f7
commit
c4576faff0
14
TestSuite/implicitexplicit5.pas
Normal file
14
TestSuite/implicitexplicit5.pas
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
type
|
||||||
|
t1 = class
|
||||||
|
i: object;
|
||||||
|
constructor(i: object);
|
||||||
|
begin
|
||||||
|
self.i := i;
|
||||||
|
end;
|
||||||
|
static function operator implicit<T>(val: T): t1 := new t1(val);
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
var a: t1 := 5;
|
||||||
|
assert(integer(a.i) = 5);
|
||||||
|
end.
|
||||||
|
|
@ -14882,6 +14882,7 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
if (expr is common_constructor_call_as_constant)
|
if (expr is common_constructor_call_as_constant)
|
||||||
return expr as common_constructor_call_as_constant;
|
return expr as common_constructor_call_as_constant;
|
||||||
convertion_data_and_alghoritms.check_convert_type(expr,tn,expr.location);
|
convertion_data_and_alghoritms.check_convert_type(expr,tn,expr.location);
|
||||||
|
return constant;
|
||||||
//AddError(new CanNotConvertTypes(expr,expr.type,tn,expr.location));
|
//AddError(new CanNotConvertTypes(expr,expr.type,tn,expr.location));
|
||||||
//throw new NotSupportedError(loc);
|
//throw new NotSupportedError(loc);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2327,6 +2327,10 @@ namespace PascalABCCompiler.TreeRealization
|
||||||
{
|
{
|
||||||
fn = fn.get_instance(ctn.instance_params, true, null);
|
fn = fn.get_instance(ctn.instance_params, true, null);
|
||||||
}
|
}
|
||||||
|
else if (fn.get_generic_params_list() != null && fn.get_generic_params_list().Count > 0)
|
||||||
|
{
|
||||||
|
fn = fn.get_instance(new List<type_node>(new type_node[] { ctn }), true, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return fn;
|
return fn;
|
||||||
}
|
}
|
||||||
|
|
@ -2358,6 +2362,10 @@ namespace PascalABCCompiler.TreeRealization
|
||||||
{
|
{
|
||||||
fn = fn.get_instance(ctn.instance_params, true, null);
|
fn = fn.get_instance(ctn.instance_params, true, null);
|
||||||
}
|
}
|
||||||
|
else if (fn.get_generic_params_list() != null && fn.get_generic_params_list().Count > 0)
|
||||||
|
{
|
||||||
|
fn = fn.get_instance(new List<type_node>(new type_node[] { ctn }), true, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return fn;
|
return fn;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue