You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I couldn't find an issue for this. sorry if there's a duplicate.
I propose updating the @nodiscard annotation to add a "reason" as to why not discard the value:
---@nodiscard [<reason>]
this would mirror Rust's #[must_use = "reason"] annotation.
example:
---Creates a new class that inherits from this one.---@returnClass---@nodiscard This method returns the new class; it's pointless to immediately discard it.functionObject:extend()
-- ...end
discarding the output would then display the warning:
*[warning][Lua Diagnostics.][discard-returns]
The return values of this function cannot be discarded:
This method returns the new class; it's pointless to immediately discard it.
note the colon at the end of "discarded".
if not given a reason, it would fall-back to the usual message, with "discarded" ending with a dot and no further explanation
(yes, I'm aware that reason in the Object:extend example isn't exactly... professional 😅)
Note
I couldn't find an issue for this. sorry if there's a duplicate.
I propose updating the
@nodiscardannotation to add a "reason" as to why not discard the value:---@nodiscard [<reason>]this would mirror Rust's
#[must_use = "reason"]annotation.example:
discarding the output would then display the warning:
note the colon at the end of "discarded".
if not given a reason, it would fall-back to the usual message, with "discarded" ending with a dot and no further explanation
(yes, I'm aware that reason in the Object:extend example isn't exactly... professional 😅)