pyrefly
pyrefly copied to clipboard
Compound `if` expressions appear to be resolved backwards when checking dict contents
Describe the Bug
See the sandbox, pyrefly is inferring a type as a literal when the if statement checks the exact opposite of that.
Note that removing the not does nothing which suggests that the not is not being considered when specializing the type
Sandbox Link
https://pyrefly.org/sandbox/?code=GYJw9gtgBALgngBwJYDsDmUkQWEMoCGAzkQKZ4D68CpAULcGGAFxQAmSAxjANpEwgANFH4gAulAC8UAN4BfekmBQARIzArMKKOsIo2OpjzVMVEpESgow+FcRXNaUZ1ABuBADZTDYY+rNOLsRklNSkABTuHsKiAJRAA
(Only applicable for extension issues) IDE Information
No response
Interesting, I think strings are supposed to be compared by equality instead of is, but != and is not both behave incorrectly here. Thanks for flagging.
Hm, somehow this no longer repros so I guess it was fixed as a byproduct of something else that landed this week. I'll add a test case to make sure it doesn't regress.