bug fix #1041
This commit is contained in:
parent
1783f0010b
commit
477b2ba180
|
|
@ -7369,7 +7369,8 @@ namespace PascalABCCompiler.NETGenerator
|
|||
box_awaited = true;
|
||||
use_stn4 = true;
|
||||
}
|
||||
|
||||
//if (ctn4 != null && ctn4.is_value_type && (ctn4 is ICommonTypeNode || ctn4 is ICompiledTypeNode && !TypeFactory.IsStandType((ctn4 as ICompiledTypeNode).compiled_type)) && ctn3 is ICompiledTypeNode && (ctn3 as ICompiledTypeNode).compiled_type != TypeFactory.ObjectType)
|
||||
// box_awaited = false;
|
||||
if (!(real_parameters[i] is INullConstantNode))
|
||||
{
|
||||
ti = helper.GetTypeReference(ctn);
|
||||
|
|
|
|||
|
|
@ -6297,7 +6297,7 @@ begin
|
|||
elem := Activator.CreateInstance(t);
|
||||
fa := t.GetFields;
|
||||
for var i := 0 to fa.Length - 1 do
|
||||
if not fa[i].IsStatic then
|
||||
if not fa[i].IsStatic and not fa[i].IsLiteral then
|
||||
fa[i].SetValue(elem, AbstractBinaryFileReadT(f, fa[i].FieldType, ind, in_arr));
|
||||
Result := elem;
|
||||
end
|
||||
|
|
@ -6390,7 +6390,7 @@ begin
|
|||
fa := t.GetFields;
|
||||
for var i := 0 to fa.Length - 1 do
|
||||
begin
|
||||
if not fa[i].IsStatic then
|
||||
if not fa[i].IsStatic and not fa[i].IsLiteral then
|
||||
Write(f, fa[i].GetValue(val), true, ind, in_arr);
|
||||
end;
|
||||
end
|
||||
|
|
@ -10820,7 +10820,7 @@ begin
|
|||
fa := t.GetFields;
|
||||
Result := 0;
|
||||
for var i := 0 to fa.Length - 1 do
|
||||
if not fa[i].IsStatic then
|
||||
if not fa[i].IsStatic and not fa[i].IsLiteral then
|
||||
Result := Result + RunTimeSizeOf(fa[i].FieldType)
|
||||
end
|
||||
else if t = typeof(string) then
|
||||
|
|
|
|||
23
TestSuite/records12.pas
Normal file
23
TestSuite/records12.pas
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
type
|
||||
r1=record
|
||||
x,y:integer;
|
||||
class function operator implicit(a:r1):string := a.x.ToString + a.y.ToString;
|
||||
end;
|
||||
|
||||
procedure test(o: object);
|
||||
begin
|
||||
assert(string(o) = '57');
|
||||
end;
|
||||
|
||||
procedure test2(o: object);
|
||||
begin
|
||||
assert(string(r1(o)) = '57');
|
||||
end;
|
||||
|
||||
begin
|
||||
var a:r1;
|
||||
(a.x,a.y) := (5,7);
|
||||
test(string(a));
|
||||
test2(a);
|
||||
test2(object(a));
|
||||
end.
|
||||
|
|
@ -677,7 +677,8 @@ namespace PascalABCCompiler.TreeConverter
|
|||
if ((ret is base_function_call))
|
||||
(ret as base_function_call).IsExplicitConversion = true;
|
||||
ret.type = to;
|
||||
ret.conversion_type = conv_type;
|
||||
if (ptc.first.convertion_method is basic_function_node)
|
||||
ret.conversion_type = conv_type;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -2361,19 +2362,37 @@ namespace PascalABCCompiler.TreeConverter
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (to_ii != null && from.semantic_node_type == semantic_node_type.delegated_method && (from as delegated_methods).proper_methods[0].ret_type is lambda_any_type_node)
|
||||
{
|
||||
delegate_internal_interface to_dii = (delegate_internal_interface)to_ii;
|
||||
if (to_dii.invoke_method.return_value_type != null)
|
||||
{
|
||||
to = to_dii.invoke_method.return_value_type;
|
||||
if (to == SystemLibrary.SystemLibrary.integer_type)
|
||||
return 94;
|
||||
else if (to == SystemLibrary.SystemLibrary.int64_type)
|
||||
return 96;
|
||||
else if (to == SystemLibrary.SystemLibrary.double_type)
|
||||
return 98;
|
||||
else
|
||||
return 1000;
|
||||
}
|
||||
}
|
||||
type_compare tc = type_table.compare_types(from, to);
|
||||
if (tc == type_compare.non_comparable_type)
|
||||
return 1000;
|
||||
if (!from.IsInterface && to.IsInterface)
|
||||
return 2;
|
||||
return 200;
|
||||
if (tc == type_compare.less_type)
|
||||
return 1;
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
if (tc == type_compare.greater_type)
|
||||
return 3;
|
||||
return 300;
|
||||
return 1000;
|
||||
}
|
||||
|
||||
|
||||
private function_node is_exist_eq_return_value_method(function_node fn, function_node_list funcs)
|
||||
{
|
||||
fn = find_eq_return_value_method_in_list(fn, funcs);
|
||||
|
|
|
|||
Loading…
Reference in a new issue