Print message before trapping, on DFINITY mode#279
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
previously, in a large number of possible error conditions, whether they
are benign (array index out of bounds) or internal (type error,
unimplemented code) we just called
Unreachable, causing a trap. Butthis is really not helpful to our early adopters.
So in
DFINITYmode, before callingUnreachable, print a helpfulerror message via
test.print.I made the strings all static, so that multiple calls with the same
error message do not have to allocate static spaces multiple times. (It
currently still does, but making sure every static string is only added
to memory once is easy to do, and independent of this change.)
Some cleanup of
compile_litalong the way. Also I preferlet open Foo inoverFoo.(…)when…is a multi-line expression with control flowand it is the last expression of the current function anyways.