8000 expression check · Issue #100 · lunarmodules/luacheck · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
expression check #100
Open
Open
@itldg

Description

@itldg

My colleague wrote the following wrong code

I didn't realize the mistake at the time, just wanted to use it as a ternary expression.

The code execution will not report an error, but it will never get the desired result.

local a = bit.isset(data1, 0) and false or true
local b= bit.isset(data2, 7) and false or true

After the code was sent to me, I saw the code error prompt in VSCODE.

[Warn type:15], or expression is always true

[Warn type:16], and expression is always false

Can luacheck detect such errors?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0