New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
frontend: propagate error as null instead of exit(1) #13625
Conversation
Thanks for your pull request, @ljmf00! Bugzilla references
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#13625" |
c7c8503
to
7e016e7
Compare
7e016e7
to
3f62aad
Compare
3f62aad
to
31e306d
Compare
@@ -793,26 +793,26 @@ extern (C++) final class Module : Package | |||
if (i >= eBuf.length) | |||
{ | |||
error("surrogate UTF-16 high value %04x at end of file", u); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how to trigger this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With a really malformed file. Try using a hex editor and tack a surrogate UTF-16 high value to the end of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you present an example? I tried but it triggers other errors. Maybe I missed something else. I don't think this is mandatory in this PR anyway, but would be cool to test this.
Unittests are not running, trying to enable it on #13626 . Rebasing on top of it. |
31e306d
to
b0e46f1
Compare
4b8337c
to
a5cd846
Compare
A different approach would be to use |
I don't think propagating a |
is this still draft? |
This patch propagates null when Module AST node can't be constructed correctly instead of doing fatal(), which terminates the program. This is useful if users use DMD frontend as a library. This patch also increases coverage on the affected lines. Fixes issue 22751. Signed-off-by: Luís Ferreira <contact@lsferreira.net>
a5cd846
to
ffd3994
Compare
Since #13628 got merged, no. |
This patch propagates null when Module AST node can't be constructed correctly
instead of doing fatal(), which terminates the program. This is useful if users
use DMD frontend as a library.
Signed-off-by: Luís Ferreira contact@lsferreira.net