Skip to content
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

Add a cargo feature to panic! early on compile errors for easier sway-core debugging? #1502

Open
mitchmindtree opened this issue May 9, 2022 · 1 comment
Labels
compiler General compiler. Should eventually become more specific as the issue is triaged

Comments

@mitchmindtree
Copy link
Contributor

During compilation, sway-core will avoid returning early on most compilation errors in order to give as much feedback to the user as is possible. This is great for the user, but can make things a bit tricky when trying to determine the source of an unintentional compile error during sway-core dev.

One thing I found myself doing quite frequently while solving bugs in #1213 was printing the checkee's span during TypedAstNode::type_check and then printing the error count at the end to work out exactly which node variant causes the error accumulation to begin.

I wonder if it might be useful to have some cargo feature, i.e. panic-on-err or something that we can use solely during debugging that causes the CompileResult err constructor to immediately panic! so that we can get a quick stack-trace directly to the site that raises the error? This might be a nice alternative to manually hunting down what CompileError was raised and where it was raised?

@mitchmindtree mitchmindtree added question compiler General compiler. Should eventually become more specific as the issue is triaged labels May 9, 2022
@sezna
Copy link
Contributor

sezna commented May 9, 2022

That's nice, and it wouldnt be hard to implement: we can just hook into ok(), check!() and err() via conditional compilation. That'd immediately cover 99% of cases.

@sezna sezna removed the question label Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler General compiler. Should eventually become more specific as the issue is triaged
Projects
Status: Todo
Development

No branches or pull requests

2 participants