-
Notifications
You must be signed in to change notification settings - Fork 506
Save native expression types by ExpressionHolder #1936
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
Save native expression types by ExpressionHolder #1936
Conversation
Sorry, I'm just on my phone. I'd expect this to be reverted here or handled better, is it? 728336c |
@ondrejmirtes |
Thank you very much! 😊 |
FYI There's some bad performance regression in this PR, it makes analysis in two real world projects run indefinitely. I'll try to figure out what's the cause. |
This commit seems so innocent a098065 but it makes this file being analysed for 27 seconds instead of 2 seconds: https://gist.github.com/ondrejmirtes/693136deb16f88a98c1973ecaad23079 It probably uncovers some underlying problem with enums and the fix is going to lie somewhere else instead of changing the lines that changed here... Currently investigating with Blackfire. |
Alright, the performance problem was fixed with this: 1ec058d |
I figured it out because I added some debug statements here: --- a/src/Analyser/NodeScopeResolver.php
+++ b/src/Analyser/NodeScopeResolver.php
@@ -2697,7 +2697,16 @@ class NodeScopeResolver
ExpressionContext::createTopLevel(),
);
$armScope = $armResult->getScope();
+ var_dump('scope first:');
+ var_dump($scope->debug());
+
+ var_dump('armScope first:');
+ var_dump($armScope->debug());
$scope = $scope->mergeWith($armScope);
+
+ var_dump('scope second:');
+ var_dump($scope->debug());
+ var_dump('------');
$hasYield = $hasYield || $armResult->hasYield();
$throwPoints = array_merge($throwPoints, $armResult->getThrowPoints());
$matchScope = $matchScope->filterByFalseyValue($filteringExpr); And the log made it obvious:
The |
Another step forward for phpstan/phpstan#8191 suggested in #1919 (comment)