sourcery
sourcery copied to clipboard
Refactoring `hoist-if-from-if` produces undefined errors
Checklist
- [√] I have searched the Sourcery documentation for the issue, and found nothing
- [√] I have checked there are no open bugs referencing the same bug or problem
Description
hoist-if-from-if may produce undefined errors.
Code snippet that reproduces issue

It moves a local variable out, causing an undefined error.
Debug Information
IDE Version: Command Line
Sourcery Version: Sourcery 1.2.0
Operating system and Version: windows 11
another bug: one item is not moved into initialization.

channel\wechatmp\reply.py:14-15 merge-dict-assign
channel\wechatmp\reply.py:14-16 merge-dict-assign
channel\wechatmp\reply.py:14-17 merge-dict-assign
channel\wechatmp\reply.py:14 dict-literal
channel\wechatmp\reply.py:34-35 merge-dict-assign
channel\wechatmp\reply.py:34-36 merge-dict-assign
channel\wechatmp\reply.py:34-37 merge-dict-assign
channel\wechatmp\reply.py:34 dict-literal
Hello, @lanvent, thanks for reporting those bugs! I'll investigate both of them and try to get them fixed as soon as possible. I moved the second bug report to https://github.com/sourcery-ai/sourcery/issues/342 for us to better keep track of it.