This is an old problem, but it is a very annoying one: Compile error messages never give the file name of the file that actually contains a compile error, instead, it seems to always be the file name of the last successfully compiled file (with line number pointing to EOF of that file).
This is misleading and makes debugging harder than it needs to be, so much so in fact, that I think it would be better if these error messages didn't give a file name at all but just the raw error ("Unknown type <xyz>" / "Undefined variable <xyz>" etc) in case there is no easy fix for the underlying problem.
For modders, it also leads to a barrage of bogus bug reports for errors that are not actually related to their project.