sourcery icon indicating copy to clipboard operation
sourcery copied to clipboard

Refactoring `hoist-if-from-if` produces undefined errors

Open lanvent opened this issue 2 years ago • 2 comments

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

image

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

lanvent avatar Apr 16 '23 15:04 lanvent

another bug: one item is not moved into initialization.

image

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

lanvent avatar Apr 16 '23 16:04 lanvent

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.

ruancomelli avatar Apr 27 '23 15:04 ruancomelli