fix #2289
This commit is contained in:
parent
80a835c5ca
commit
434f846ee4
|
|
@ -15,7 +15,7 @@ internal static class RevisionClass
|
||||||
public const string Major = "3";
|
public const string Major = "3";
|
||||||
public const string Minor = "6";
|
public const string Minor = "6";
|
||||||
public const string Build = "3";
|
public const string Build = "3";
|
||||||
public const string Revision = "2616";
|
public const string Revision = "2617";
|
||||||
|
|
||||||
public const string MainVersion = Major + "." + Minor;
|
public const string MainVersion = Major + "." + Minor;
|
||||||
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
%COREVERSION%=3
|
|
||||||
%REVISION%=2616
|
|
||||||
%MINOR%=6
|
%MINOR%=6
|
||||||
|
%REVISION%=2617
|
||||||
|
%COREVERSION%=3
|
||||||
%MAJOR%=3
|
%MAJOR%=3
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
3.6.3.2616
|
3.6.3.2617
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
!define VERSION '3.6.3.2616'
|
!define VERSION '3.6.3.2617'
|
||||||
|
|
|
||||||
18
TestSuite/class_interf.pas
Normal file
18
TestSuite/class_interf.pas
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
type
|
||||||
|
i1 = interface
|
||||||
|
procedure p;
|
||||||
|
end;
|
||||||
|
|
||||||
|
c1 = abstract class(i1)
|
||||||
|
public
|
||||||
|
procedure p;
|
||||||
|
begin
|
||||||
|
Assert(111=111);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
c2 = sealed class(c1) end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
var a := new c2 as i1;
|
||||||
|
a.P
|
||||||
|
end.
|
||||||
|
|
@ -1561,6 +1561,16 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
return eq_type_nodes(tn1, tn2, false);
|
return eq_type_nodes(tn1, tn2, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool type_or_base_type_implements_interface(type_node tn, type_node interf)
|
||||||
|
{
|
||||||
|
do {
|
||||||
|
if (tn.ImplementingInterfaces.Contains(interf))
|
||||||
|
return true;
|
||||||
|
tn = tn.base_type;
|
||||||
|
} while (tn != null);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//Этот метод сверяет не только параметры, но и возвращаемое значение
|
//Этот метод сверяет не только параметры, но и возвращаемое значение
|
||||||
public static bool function_eq_params_and_result(function_node left, function_node right, bool weak = false)
|
public static bool function_eq_params_and_result(function_node left, function_node right, bool weak = false)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3066,6 +3066,7 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
weak_node_test_and_visit(_interface_node.interface_definitions);
|
weak_node_test_and_visit(_interface_node.interface_definitions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void visit(SyntaxTree.typecast_node node)
|
public override void visit(SyntaxTree.typecast_node node)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -3093,7 +3094,9 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
{
|
{
|
||||||
AddError(loc, "EXPECTED_DERIVED_CLASSES");
|
AddError(loc, "EXPECTED_DERIVED_CLASSES");
|
||||||
}
|
}
|
||||||
if (en.type.IsSealed && tp.IsInterface && !en.type.ImplementingInterfaces.Contains(tp))
|
if (en.type.IsSealed && tp.IsInterface && /*!en.type.ImplementingInterfaces.Contains(tp)*/
|
||||||
|
!convertion_data_and_alghoritms.type_or_base_type_implements_interface(en.type,tp)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
AddError(loc, "CAN_NOT_CONVERT_TYPE_{0}_TO_INTERFACE_{1}", en.type.PrintableName, tp.PrintableName);
|
AddError(loc, "CAN_NOT_CONVERT_TYPE_{0}_TO_INTERFACE_{1}", en.type.PrintableName, tp.PrintableName);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue