This commit is contained in:
parent
2f1458834d
commit
058f4785e6
9
TestSuite/enum8.pas
Normal file
9
TestSuite/enum8.pas
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
type
|
||||
enum1 = (
|
||||
v1 = 1,
|
||||
v2 = v1
|
||||
);
|
||||
|
||||
begin
|
||||
assert(v2 = v1);
|
||||
end.
|
||||
|
|
@ -679,9 +679,11 @@ namespace PascalABCCompiler.TreeConverter
|
|||
AddError(new CanNotConvertTypes(en, dm.proper_methods[0].ret_type, to, loc)); // SSM 18/06/20 #2261
|
||||
else
|
||||
return en;
|
||||
}
|
||||
}
|
||||
else if (en.type is undefined_type && en is base_function_call bfc)
|
||||
throw new SimpleSemanticError(loc, "RETURN_TYPE_UNDEFINED_{0}", bfc.function.name);
|
||||
else if (en is enum_const_node && (en as enum_const_node).constant_value != 0)
|
||||
return new int_const_node((en as enum_const_node).constant_value, loc);
|
||||
else AddError(new CanNotConvertTypes(en, en.type, to, loc));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1112,6 +1112,12 @@ namespace PascalABCCompiler.TreeConverter
|
|||
|
||||
type_node left_type = left.type;
|
||||
type_node right_type = right.type;
|
||||
if (left_type == null && left is enum_const_node)
|
||||
{
|
||||
left_type = SystemLibrary.SystemLibrary.integer_type;
|
||||
left.type = left_type;
|
||||
}
|
||||
|
||||
|
||||
if (left_type.semantic_node_type == semantic_node_type.delegated_method)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue