When for instance an integer variable and a location are given the same name, as in the example model that is attached, then this produces no error message. When one then tries to reference the integer variable in a guard, then the error message reads: Identifier of this type cannot be referenced in an expression. If the user thinks that this refers to the integer variable then the error can be hard to understand and correct. The prefered solution would be to come up with an error message initially for the naming conflict.
I agree that the error message is misleading (although correct). However, notice that it is perfectly legal for a location to have the same name as a global variable (as the location is defined in a nested scope). A better solution is to change the error message produced when refering to the location to: "Locations cannot be referenced at this point.".
I will fix this in the 3.5 code base. Eventually, we will backport the fix to 3.4.
Moved bug to 3.5.7, as 3.4 is a stable release series and fixing a minor bug is not worth the risk.
The error messages for invariants and guards have now been changed to include the type of the expression.