dead code is not an error #118

Closed
opened 2021-11-29 18:02:29 +08:00 by sb10q · 3 comments

During debugging, it is useful to insert a return statement in the middle of a function.
Currently this fails with thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "dead code at Location { row: 116, column: 13 }"', nac3artiq/src/lib.rs:447:44

This should be demoted to a warning and the compilation should continue.

During debugging, it is useful to insert a return statement in the middle of a function. Currently this fails with ``thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "dead code at Location { row: 116, column: 13 }"', nac3artiq/src/lib.rs:447:44`` This should be demoted to a warning and the compilation should continue.
ychenfo was assigned by sb10q 2021-12-21 19:11:29 +08:00
sb10q added this to the Beta milestone 2022-04-12 11:04:15 +08:00
Poster
Owner

And generally: how should we report warnings?

And generally: how should we report warnings?
Collaborator

And generally: how should we report warnings?

iirc currently the only functions that need to return warnings are check_blocks and check_stmts, whose return types are Result<bool, String>. Maybe we can change it to something like Result<(bool, Vec<WarningMsg>), String>? and just print out the sorted warning messages if nac3 is not configured to suppress warnings.

> And generally: how should we report warnings? iirc currently the only functions that need to return warnings are `check_blocks` and `check_stmts`, whose return types are `Result<bool, String>`. Maybe we can change it to something like `Result<(bool, Vec<WarningMsg>), String>`? and just print out the sorted warning messages if nac3 is not configured to suppress warnings.

I think we should implement something like the diagnostic class in the legacy compiler. Returning an result will only work for errors.

I think we should implement something like the diagnostic class in the legacy compiler. Returning an result will only work for errors.
sb10q closed this issue 2023-10-04 21:30:43 +08:00
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/nac3#118
There is no content yet.