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

expression check #232

Closed
itldg opened this issue Aug 30, 2023 · 3 comments
Closed

expression check #232

itldg opened this issue Aug 30, 2023 · 3 comments

Comments

@itldg
Copy link

itldg commented Aug 30, 2023

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?

@itldg
Copy link
Author

itldg commented Aug 30, 2023

I am deeply saddened to hear about his passing. He was an exceptional developer and an admirable individual. His contributions and talent will be forever remembered. May he rest in peace.

@itldg itldg closed this as completed Aug 30, 2023
@alerque
Copy link

alerque commented Sep 2, 2023

Please feel free to re-open this issue on the new canonical fork of this repository in the @lunarmodules org.

@alerque
Copy link

alerque commented Sep 2, 2023

Never mind, it appears you did, it was just buried in my notifications.

lunarmodules#100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants