Currently catastrophic errors, where a error occurs due to incorrect compiler implementation, are handled with assertions.
There are enough points in the compiler where such tests are performed. e.g. some AST visitor implementation has AST node types that it should never be called on, and if the visitor finds itself visiting one it is a sign that there was a problem with the compiler implementation. In such cases, instead of just assert(false), should we throw an exception which is handled in a uniform manner?
Currently catastrophic errors, where a error occurs due to incorrect compiler implementation, are handled with assertions.
There are enough points in the compiler where such tests are performed. e.g. some AST visitor implementation has AST node types that it should never be called on, and if the visitor finds itself visiting one it is a sign that there was a problem with the compiler implementation. In such cases, instead of just
assert(false)
, should we throw an exception which is handled in a uniform manner?