Incorrect Identification of SObjectField type.
I think screenshot explains it all? Let me know if you need more info.
Comments (7)
-
repo owner -
reporter No there’s no variable named account.
Here’s the whole top of the class.
The only thing I could think of is the `new Account` declarations below it. But as you can see the very first line in the first method is exhibiting the issue.
-
reporter I’ll create a new scratch org and see if I can replicate.
-
reporter Ok figured out what it was.
Under the .sfdx dir there were 2 directories: .sfdx/tools/standardObjects & .sfdx/tools/customObjects. Somehow IC was indexing this? So I deleted these dirs and all the issues went away.
I take it those directories are part of the vscode stuff (had a look to see where it was at and it’s crap compared to IC ).
-
reporter - changed version to 2.0.7.5
-
repo owner - changed status to duplicate
Duplicate of
#1356. -
repo owner Okay, then this is a duplicate of
#1356. The workaround is to set.sfdx
to be an excluded directory for the project. - Log in to comment
Do you happen to have a variable named
account
in the same context? If so, that's the issue, and it's an IC bug, but not a very easy one to fix. Because of the Apex's case-insensitive nature, IC currently resolvesAccount
in that expression to the variableaccount
, and that makesAccount.LastActivityDate
a field value rather than a compile-time constant for the fieldLastActivityDate
on the SObject typeAccount
. The Salesforce Apex compiler has some special provisions for handling that which I haven't yet implemented.If there's no variable named
account
, I'm currently unable to reproduce what you're seeing. Perhaps you could provide a standalone reproducible example?