I have a project I just spent quite a bit of time modifying and all of a sudden I am getting an error I can not resolve.
“You must use the value returned by this function”
This is on a method that has no return type and is only called in one place in the project. The work I did today was not even remotely related to this. The other unusual thing is the bug icon is not on a line per usual but between lines.
Time for a bike ride to clear my head. Hopefully someone will have some ideas.
[quote=205285:@Peter Fargo]I have a project I just spent quite a bit of time modifying and all of a sudden I am getting an error I can not resolve.
“You must use the value returned by this function”
This is on a method that has no return type and is only called in one place in the project. The work I did today was not even remotely related to this. The other unusual thing is the bug icon is not on a line per usual but between lines.
Time for a bike ride to clear my head. Hopefully someone will have some ideas.[/quote]
What puzzles me most is that the bug does appear between two code lines. Have you checked thoroughly for unintentional duplicate or shadowing properties, methods or structures? Sometimes the compiler may give very misleading hints - but whom do I tell?
I had encountered a situation where a project was running fine but after save and reload brought mystical errors. In that case it was a conflict in an enumeration which I could handle by fully qualifying the enumeration path although it was added globally in a module.
Not sure it would help, but try saving a copy of the project as binary or XML and try to run the copy. You might see the error tagged in the actual location where the error is…
I’ve seen this happen more than a couple of times. It seems like sometimes there’s an error in a different file from where the compiler thinks it is. Very hard to track down… I haven’t been able to figure out the conditions that lead to it. It usually involves going through every line of every item I’ve touched and looking for anything odd. You could also, try commenting chunks of code where you’ve been working until the error stops to narrow it down.
I had an issue a few month ago, where I couldn’t compile with weird error messages. The next change anywhere in the project made compiling possible. After the next change I couldn’t compile anymore. Next change: compiled. Next change: didn’t. And so on. Strange compiler error.
Could never resolve it. Had to go back to a working version and implement my stuff completely different. My conclusion was, that Xojo somehow reached an internal limit of namespaces and Using clauses.
Your issue is probably something completely different, but who knows with such weird stuff.
Every time I have run into strange, unexplained compile issues like this, clearing the cache has resolved them. This is, of course, purely anecdotal and may have nothing to do with your situation, but your description sounds very much like an out of sync app cache.
Ok, I got mine fixed by deleting items until the error subsided.
The origin for me was this… a class with a property (mTextSize). A subclass with a computed property (TextSize). In the getter and setter, the subclass sets and gets super.mTextSize where it should be referencing me.mTextSize
I’m going to try and reproduce this in a separate project to submit…
This is not a bug. Properties cannot be overridden like methods. Therefore you also cannot use Super.
Solution: remove Super. in the setter and getter of the subclass.
Both would return the same mTextSize as mTextSize is declared in the superclass. You access it by Self.mTextSize or mTextSize.
If you would have defined an additional mTextSize in the subclass, this could be dangerous and it is not recommended to do. This does not add a second property mTextSize, it shadows the superclass’s mTextSize, making it inaccessible for the subclass.
I understand the issues with shadowing. One minor bug perhaps being the fact that autocomplete is happy to fill in properties from the superclass via super dot.
The real bug is in the IDE. The compiler throws an error pointing to an unrelated item in the project. Try running the project attached to the bug report to see what I mean.
Fun part is I’ve looked at it and the compiler is actually telling the IDE something rather weird in terms of where it thinks the error is
The IDE is doing its best to show you something that is truly odd from the compiler