This commit is contained in:
Ivan Bondarev 2021-08-09 10:38:20 +02:00
parent bcad373248
commit 232d7b1cc9
3 changed files with 21 additions and 4 deletions

5
TestSuite/enum6.pas Normal file
View file

@ -0,0 +1,5 @@
begin
var a := System.Globalization.UnicodeCategory.Format;
assert(a.GetType().FullName = 'System.Globalization.UnicodeCategory');
assert(System.Globalization.UnicodeCategory.Format(typeof(System.Globalization.UnicodeCategory), a, 'd') = '15');
end.

View file

@ -2118,12 +2118,13 @@ namespace PascalABCCompiler.TreeConverter
// В режиме only_from_not_extensions пропускать все extensions
if (only_from_not_extensions && (function.sym_info is function_node) && (function.sym_info as function_node).is_extension_method)
continue;
#if (DEBUG)
if (function.sym_info.general_node_type != general_node_type.function_node && function.sym_info.general_node_type != general_node_type.property_node)
{
throw new CompilerInternalError("Function name is used to define another kind of object.");
continue;
//throw new CompilerInternalError("Function name is used to define another kind of object.");
}
#endif
function_node fn = null;
if (function.sym_info.general_node_type == general_node_type.property_node)
{

View file

@ -1567,7 +1567,7 @@ namespace PascalABCCompiler.TreeConverter
{
fn = (si.sym_info as common_property_node).get_function;
}
if (convertion_data_and_alghoritms.find_eq_method_in_list(fn, fnl) == null)
if (fn != null && convertion_data_and_alghoritms.find_eq_method_in_list(fn, fnl) == null)
{
if (!(obj != null && fn.polymorphic_state == SemanticTree.polymorphic_state.ps_static && !fn.is_extension_method))
{
@ -9352,6 +9352,17 @@ namespace PascalABCCompiler.TreeConverter
else
dn = context.check_name_node_type(id_right.name, si_right?.FirstOrDefault(), get_location(id_right), general_node_type.variable_node,
general_node_type.function_node, general_node_type.property_node, general_node_type.constant_definition);
if (si_right != null && si_right.Count > 1 && dn is function_node)
foreach (SymbolInfo si in si_right)
{
if (si.sym_info is var_definition_node)
{
dn = context.check_name_node_type(id_right.name, si, get_location(id_right), general_node_type.variable_node,
general_node_type.function_node, general_node_type.property_node, general_node_type.constant_definition);
break;
}
}
switch (dn.general_node_type)
{
case general_node_type.variable_node: