diff --git a/NETGenerator/NETGenerator.cs b/NETGenerator/NETGenerator.cs index a0300d86a..04fe0f20c 100644 --- a/NETGenerator/NETGenerator.cs +++ b/NETGenerator/NETGenerator.cs @@ -8268,7 +8268,7 @@ namespace PascalABCCompiler.NETGenerator private bool EmitBox(IExpressionNode from, Type LocalType) { - if ((from.type.is_value_type || from.type.is_generic_parameter) && !(from is SemanticTree.INullConstantNode) && (LocalType == TypeFactory.ObjectType || TypeIsInterface(LocalType))) + if ((from.type.is_value_type || from.type.is_generic_parameter) && !(from is SemanticTree.INullConstantNode) && (LocalType == TypeFactory.ObjectType || TypeIsInterface(LocalType) || LocalType == TypeFactory.EnumType)) { il.Emit(OpCodes.Box, helper.GetTypeReference(from.type).tp);//упаковка return true; diff --git a/TestSuite/enum10.pas b/TestSuite/enum10.pas new file mode 100644 index 000000000..728ac9f18 --- /dev/null +++ b/TestSuite/enum10.pas @@ -0,0 +1,12 @@ +type + Days = (mon,Tue,Wed,Thi,Fri,Sat,Sun); + +procedure MyPrint(obj: object); +begin + assert(obj.ToString() = 'Fri'); +end; +begin + var en: System.Enum; + en := fri; + MyPrint(en); +end. \ No newline at end of file