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

fix missing case for displaying varId #7054

Merged
merged 2 commits into from Dec 9, 2021
Merged

fix missing case for displaying varId #7054

merged 2 commits into from Dec 9, 2021

Conversation

orklah
Copy link
Collaborator

@orklah orklah commented Dec 3, 2021

This will fix #6933

The message is a little weird because it says Cannot access value on variable ARR when it's a constant, but it's not a big deal.

Didn't add test because this is just a wording issue

@orklah orklah added the release:fix The PR will be included in 'Fixes' section of the release notes label Dec 3, 2021
@orklah
Copy link
Collaborator Author

orklah commented Dec 4, 2021

This revealed a deeper bug where, if a constant have a varId, it is affected by assertions a weird way and this snippet https://psalm.dev/r/8c26aa0e98 produce an error because DIRECTORY_SEPARATOR somehow became mixed

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/8c26aa0e98
<?php


class A
{
    public static function analyze(): void
    {
        $is_path_relative= false;
        if (DIRECTORY_SEPARATOR === '/') {
            $is_path_relative = true;
        }

        if ($is_path_relative) {
            echo 'a' . DIRECTORY_SEPARATOR;
        }
    }

}
Psalm output (using commit 16a61a7):

No issues!

@orklah
Copy link
Collaborator Author

orklah commented Dec 9, 2021

Well, this is working. I'm not sure I like the fact that I had to call an Analyzer inside the Reconciler though, but I couldn't see a cache of global constants and I'm not sure we're supposed to create one...

@orklah
Copy link
Collaborator Author

orklah commented Dec 9, 2021

Do you have thoughts about that @weirdan ?

@weirdan
Copy link
Collaborator

weirdan commented Dec 9, 2021

Looks good to me.

@orklah orklah merged commit ae765df into vimeo:master Dec 9, 2021
orklah added a commit to orklah/psalm that referenced this pull request Jan 1, 2022
@orklah orklah mentioned this pull request Jan 1, 2022
orklah added a commit that referenced this pull request Jan 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:fix The PR will be included in 'Fixes' section of the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing constant name in the error message
2 participants