fix #2120
This commit is contained in:
parent
564ebf9799
commit
6726ad8891
|
|
@ -15,7 +15,7 @@ internal static class RevisionClass
|
|||
public const string Major = "3";
|
||||
public const string Minor = "6";
|
||||
public const string Build = "2";
|
||||
public const string Revision = "2361";
|
||||
public const string Revision = "2365";
|
||||
|
||||
public const string MainVersion = Major + "." + Minor;
|
||||
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
%MINOR%=6
|
||||
%REVISION%=2361
|
||||
%REVISION%=2365
|
||||
%COREVERSION%=2
|
||||
%MAJOR%=3
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
3.6.2.2361
|
||||
3.6.2.2365
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
!define VERSION '3.6.2.2361'
|
||||
!define VERSION '3.6.2.2365'
|
||||
|
|
|
|||
|
|
@ -12507,12 +12507,16 @@ begin
|
|||
result := 0;
|
||||
end;
|
||||
|
||||
type NotPinnableWrapper = class
|
||||
[ThreadStatic]
|
||||
static notPinnableTypes: HashSet<&Type>;
|
||||
end;
|
||||
|
||||
// -----------------------------------------------------
|
||||
// Internal procedures for PABCRTL.dll: implementation
|
||||
// -----------------------------------------------------
|
||||
var
|
||||
__initialized := false;
|
||||
notPinnableTypes: HashSet<&Type> := nil;
|
||||
|
||||
[System.Diagnostics.DebuggerStepThrough]
|
||||
function __FixPointer(obj: object): GCHandle;
|
||||
|
|
@ -12520,14 +12524,14 @@ begin
|
|||
if obj <> nil then
|
||||
begin
|
||||
try
|
||||
if notPinnableTypes.Contains(obj.GetType()) then
|
||||
if (NotPinnableWrapper.notPinnableTypes <> nil) and NotPinnableWrapper.notPinnableTypes.Contains(obj.GetType()) then
|
||||
Result := GCHandle.Alloc(obj)
|
||||
else
|
||||
Result := GCHandle.Alloc(obj, GCHandleType.Pinned);
|
||||
except
|
||||
if notPinnableTypes = nil then
|
||||
notPinnableTypes := new HashSet<&Type>;
|
||||
notPinnableTypes.Add(obj.GetType());
|
||||
if NotPinnableWrapper.notPinnableTypes = nil then
|
||||
NotPinnableWrapper.notPinnableTypes := new HashSet<&Type>;
|
||||
NotPinnableWrapper.notPinnableTypes.Add(obj.GetType());
|
||||
Result := GCHandle.Alloc(obj);
|
||||
end;
|
||||
end;
|
||||
|
|
|
|||
21
TestSuite/af1_method_call_as_procedure.pas
Normal file
21
TestSuite/af1_method_call_as_procedure.pas
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
type
|
||||
TBase = class
|
||||
function f1: real;
|
||||
begin
|
||||
Result := 3.5;
|
||||
Assert(False);
|
||||
end;
|
||||
end;
|
||||
|
||||
TErr = class(TBase)
|
||||
function f1: integer;
|
||||
begin
|
||||
Result := 2
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
var a := new TErr;
|
||||
Assert(a.f1=2);
|
||||
a.f1;
|
||||
end.
|
||||
|
|
@ -1927,7 +1927,14 @@ namespace PascalABCCompiler.TreeConverter
|
|||
if ((parameters.Count >= cfn.parameters.Count - cfn.num_of_default_variables) &&
|
||||
(parameters.Count <= cfn.parameters.Count) || parameters.Count == 0 && cfn.parameters.Count == 1 && cfn.parameters[0].is_params)
|
||||
{
|
||||
if (is_exist_eq_method_in_list(fn, set_of_possible_functions) != null)
|
||||
var fm = find_eq_method_in_list(fn, set_of_possible_functions); // без возвращаемого значения в отличие от is_exist_eq_method_in_list
|
||||
|
||||
bool bo = fm != null;
|
||||
if (bo)
|
||||
bo = eq_type_nodes(fn.return_value_type, fm.return_value_type);
|
||||
|
||||
//var bo = is_exist_eq_method_in_list(fn, set_of_possible_functions) != null;
|
||||
if (bo)
|
||||
{
|
||||
if (set_of_possible_functions.Count > 0)
|
||||
if (set_of_possible_functions[0] is basic_function_node)
|
||||
|
|
@ -1938,7 +1945,12 @@ namespace PascalABCCompiler.TreeConverter
|
|||
|
||||
continue;
|
||||
}
|
||||
set_of_possible_functions.Add(fn);
|
||||
if (fm != null && fn is common_method_node cmnfn && fm is common_method_node cmnfm && cmnfn.comperehensive_type != cmnfm.comperehensive_type)
|
||||
{
|
||||
//fn = fn;
|
||||
}
|
||||
// Если fm и fn принадлежат к разным классам, то не добавлять fn - она принадлежит предку поскольку встречалась позже
|
||||
else set_of_possible_functions.Add(fn);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in a new issue