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
Class extenting stub class is not analyzed #3328
Labels
Comments
Hey @joehoyle, can you reproduce the issue on https://psalm.dev ? |
No, this is not reproducible on psalm.dev as there's no way to load Stub files there that I'm aware of. |
joehoyle
added a commit
to joehoyle/psalm
that referenced
this issue
Jul 8, 2020
Currently project files are scanned before stub files, this means if project files have dependencies on things declared in stubs (such as child classes), analysis essentially fails, as the Populator will bail in `populateDataFromParentClass -> 'Populator could not find dependency ...'`. I imagine there is some reason behind scanning the project files before the stubs, but I'm not sure what it is. I decided to go ahead and make this change and also add a test demonstrating the problem. without switching the order, the attached test case will not throw any errors (when it should!). Fixes vimeo#3328.
Are you sure your stub is self contained? All dependancies of your stubbed class must also be stubbed EDIT: I could reproduce it indeed |
Works with |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When I have a class that extends a class in my stub files, I don't get any analysis or failures on missing types in my subclass. I see
Populator could not find dependency (521)
when running./vendor/bin/psalm --debug
. I can confirm the stub file is being ingested, because if I remove it, I got anUndefinedClass
error.I uploaded a very simple sample project to https://gist.github.com/joehoyle/203a52d80f21ce56636d45bac81f2b8f, you can clone and test locally with
git clone https://gist.github.com/203a52d80f21ce56636d45bac81f2b8f.git
I see #1528 which looks quite related, but then the tests in 39f7296 don't look like they are testing if invalid code shows as failing, when it should, so maybe this isn't be tested for right now.
The text was updated successfully, but these errors were encountered: