Skip to content

Warning/hint on redundant except ... #23366

Open
@arnetheduck

Description

@arnetheduck

Summary

Introduce a warning for dead exception handlers

Description

In the following code snippet, no exceptions can be raised and therefore, the exception handler is dead code which can be removed. Similar to other cases of dead code, this should have a warning:

proc f() {.raises: [].} = discard

try:
  f()
except CatchableError: # No exceptions can result from `f`
  discard

Alternatives

No response

Examples

No response

Backwards Compatibility

No response

Links

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions