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

False positive UnusedFunctionCall with @psalm-pure annotation #5540

Closed
Etherlord opened this issue Mar 31, 2021 · 3 comments
Closed

False positive UnusedFunctionCall with @psalm-pure annotation #5540

Etherlord opened this issue Mar 31, 2021 · 3 comments
Labels

Comments

@Etherlord
Copy link

With @psalm-pure https://psalm.dev/r/8b8c7787b4
Without @psalm-pure https://psalm.dev/r/f979691a2a

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/8b8c7787b4
<?php

/**
 * @psalm-pure
 */
function getException(): \Exception
{
    return new \Exception();
}

throw getException();
Psalm output (using commit ece1385):

ERROR: UnusedFunctionCall - 11:7 - The call to getexception is not used
https://psalm.dev/r/f979691a2a
<?php

function getException(): \Exception
{
    return new \Exception();
}

throw getException();
Psalm output (using commit ece1385):

No issues!

@weirdan weirdan added the bug label Mar 31, 2021
@weirdan
Copy link
Collaborator

weirdan commented Mar 31, 2021

Unused*Call applies to pure functions / methods only, but it shouldn't be reported in the first snippet.

@1ed
Copy link

1ed commented Mar 31, 2021

Maybe related to #5528

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

No branches or pull requests

3 participants