Illegal assignment from Integer or Decimal to Currency
In IC 2.0, I get "Illegal assignment from Integer to Currency" and "Illegal assignment from Decimal to Currency" errors when I assign a hard coded integer or decimal value to a currency field.
Comments (10)
-
repo owner -
repo owner Actually, before I do that, have you regenerated your OST?
Currency
fields should be rendered into the OST asDecimal
now. Or in this case are you doing something like:Currency currencyValue = 10.0;
Just trying to make sure I look at the right thing when I triage this.
-
repo owner - changed component to Code Inspections and Intentions
-
assigned issue to
-
reporter Yes. I just regenerated the sObject OST and the errors are still there.
-
reporter Nevermind. The errors went away.
-
repo owner Are the fields in the OST of type
Decimal
orCurrency
after OST regeneration? If they'reDecimal
, you likely saw the "residue" of those inspections while it indexed the new OST, after which they were removed because of the change fromCurrency
toDecimal
which allows for assignment. -
reporter They're Decimal in the OST after regeneration.
-
repo owner - changed status to resolved
Gotcha. I'm going to resolve this for now assuming that was the fix, but if you see any other code inspection false negatives, please let me know (ideally along with standalone reproducible examples) and I'll take care of them ASAP.
-
Account Deactivated Hi all - ran into the same issue when upgrading from IC to IC2, found this post, and doing a full OST regen fixed it.
Mike
-
repo owner Thanks for confirming that resolved the issue, Mike!
- Log in to comment
I'm still working through a few false negatives from IC2's new code inspections. I'll add this to the list for the next build. Thanks for reporting!