Skip to content

Code action to apply DeMorgan's law #1243

Open
@DougGregor

Description

@DougGregor

Description

Sometimes in code we end up with something like:

if !x && y != z { ... }

and it would be cleaner to apply DeMorgan's law to make this:

if !(x || y == z) { ... }

We should have a code action to do this correctly, which requires dealing with inverting conditions and dealing with operator precedence. The SwiftOperators module of swift-syntax can help here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    code actionCode action provided by LSPenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions