I've got a syntax node with diagnostics attached to it:
var arr = [1, 2, 3];
Which get rewritten into its correct form before any compilation is created. However, after created the compilation crashes with an InvalidCast trying to convert an ExtendedError into an ArrayType. Is this the expected behavior? Looking at the code it seems
Diagnostics cannot be removed, even if the current tree is changed and correct?
Currently I'm solving the problem by recompiling everything(i.e. converting the tree into a string and re-parsing it) It is not enough to recompile the offending file, I need to recompile every syntax tree in the compilation, which is very bad since references
to the original file are lost.
Am I doing something wrong? Is there a better way to do this?