When a class has a template constraint, using a templated type as a parameter for a function that doesn't specify the template incorrectly changes the variable to have the constraint type instead of the templated type: https://psalm.dev/r/6b46d38af2
In fact, both of these are incorrect because the template isn't covariant. You can see here that when non-literals are involved the actual issue is shown.
I believe this special handling of literals was adding so that there wouldn't be a bunch of "false positives" for stuff like this, but I think this special handling should be removed once #8066 is fixed.
When a class has a template constraint, using a templated type as a parameter for a function that doesn't specify the template incorrectly changes the variable to have the constraint type instead of the templated type: https://psalm.dev/r/6b46d38af2
When there is no template constraint this doesn't happen: https://psalm.dev/r/cd80832550
In fact, both of these are incorrect because the template isn't covariant. You can see here that when non-literals are involved the actual issue is shown.
I believe this special handling of literals was adding so that there wouldn't be a bunch of "false positives" for stuff like this, but I think this special handling should be removed once #8066 is fixed.