Does the compiler caches emitted errors?

Maybe the question from the topic is not clear enough. I was migrating a library in our app which brought quite a few braking changes. The compiler emitted a few hundreds or errors which I had manually to fix. I did that, but for some reason the compiler seemed (or static analyser? - how is this called correctly?) to remember those errors even after they were resolved and syntax highlighting partly confirmed it. I tried clearing the build and deleting everything from DerivedData but nothing helped. The last resort was to manually delete those affected lines and re-add them so the errors finally did go away.

So my question is, does the compiler or any related system caches the errors at some point and is there a better way to force clear those to re-analyse the code than deleting and re-adding everything?

I was using Xcode 9.4.

This sounds like an Xcode bug, but probably not one that's actionable now that you've cleaned up your build directory and such. The compiler itself doesn't have any state between builds. (I believe SourceKit does, but not for diagnostics.)

2 Likes

Correct, sourcekitd doesn't cache diagnostics across compilations.