Skip to content

@nodiscard don't check all return values [BUG] or [enhancement] #2112

@sadSader

Description

@sadSader

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Linux

What is the issue affecting?

Annotations, Type Checking

Expected Behaviour

There is a lot of functions which return errors as second return value (example: io.open, file:write()) but nondiscard don't check that all return values not discarded

  1. nodiscard show warning when any of return values is ignored
    or
  2. Option to mark each return value as non-discardable

Actual Behaviour

image

Reproduction steps

local f = io.open() -- should be message that errmsg can't be discarded

Additional Notes

No response

Log File

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionUser has a question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions