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

Wrong template inheritance with stubs #4539

Closed
thomasvargiu opened this issue Nov 12, 2020 · 5 comments
Closed

Wrong template inheritance with stubs #4539

thomasvargiu opened this issue Nov 12, 2020 · 5 comments

Comments

@thomasvargiu
Copy link
Contributor

Seems the same resolved issue #4524, but with stubs.

See this project:

https://github.com/thomasvargiu/psalm-issues-tests/tree/wrong-template-inheritance-with-stubs

Where there are:

In the CI you can see:

$identity = new Original\Identity('foo');
$function = fn (string $a): int => random_int(-1, 1);

/** @psalm-trace $value */
$value = $identity->map($function);
``` 

ERROR: Trace - test.php:9:1 - $value: Original\Functor (see https://psalm.dev/224)
/** @psalm-trace $value */
$value = $identity->map($function);


When instead I expect `$value` as `Original\Functor<int>`.
If I remove docblock from the original file it works.

@muglug I added you to the repository, so you can run tests again. It uses psalm master branch.
@psalm-github-bot
Copy link

Hey @thomasvargiu, can you reproduce the issue on https://psalm.dev ?

@muglug
Copy link
Collaborator

muglug commented Nov 12, 2020

Before I delve into this, mind checking to see if it works with latest master?

@thomasvargiu
Copy link
Contributor Author

Yeah it works! Thanks!

@thomasvargiu
Copy link
Contributor Author

@muglug You're so fast!
I was reopening it founding another bug introduced in last commits! And you already resolved! Thanks for your work!
I'm not confident yet with Psalm internals to open a PR in a short time!

@muglug
Copy link
Collaborator

muglug commented Nov 12, 2020

Yeah, this fix was not trivial: 3dd185e (and broke Psalm itself, leading to two additional fixes).

If you want to brush up on Psalm's internals there are a ton of bugs here: https://github.com/vimeo/psalm/issues?q=is%3Aopen+is%3Aissue+label%3A%22easy+problems%22

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