fix compilation helper s.t. separate compilation test passes
extract diagnostic construction in error collector into helper method