Показать сообщение отдельно
Старый 02.08.2014, 16:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,644 / 848 (80) +++++++
Регистрация: 28.10.2006
goshoom: Operand types are not compatible
Источник: http://dev.goshoom.net/en/2014/08/op...ot-compatible/
==============

I managed to produce a really confusing error in AX 2012. Look at the following piece of code:

MyExtendedDataType a, b; a = b;
Pretty boring, isn’t it? There is nothing to fail… except that I got a compilation error: Operand types are not compatible with the operator. What?

Actually it become quite clear as soon as I simplified my code to this trivial example. There is clearly nothing wrong with my code, it must have something to do with the data type.

To make a long story short, I created a new extended data type of type enum and forgot to fill in the EnumType property. Linking the EDT to an enum instantly solved the problem.

But beware – the compiler won’t detect many other uses of this incorrectly-defined type. For example, MyExtendedDataType a = NoYes::Yes; is compilable X++ code even if MyExtendedDataType has empty EnumType.



Источник: http://dev.goshoom.net/en/2014/08/op...ot-compatible/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.