vimeo / psalm

A static analysis tool for finding errors in PHP applications
https://psalm.dev
MIT License
5.55k stars 659 forks source link

Union type `Foo<object>&Foo<stdClass>` not simplified after assert #10216

Open ciaranmcnulty opened 1 year ago

ciaranmcnulty commented 1 year ago

https://psalm.dev/r/b61324f01c

I would expect the trace result to be Foo<stdClass>

psalm-github-bot[bot] commented 1 year ago

I found these snippets:

https://psalm.dev/r/b61324f01c ```php $this */ public function supports(object $type) : bool; } function foo (Foo $f): void { if ($f->supports(new stdClass)) { /** @psalm-trace $f */ } } ``` ``` Psalm output (using commit 7428e49): INFO: Trace - 18:0 - $f: Foo&Foo ```