fix($compile): check clashing directives before compilation

Closes #3893