This introduces the hidden assumption that only the last function in scope will ever use the class methods, which is clearly incorrect. It is somewhat surprising that this is an issue at all, because all functions defined in the same scope should be visible at any time (i.e., back references should be possible) but the fact that this line suspiciously removes the last node and re-appends it (usually the validator, especially in the small test cases in the test suite) is suspiciously suspicious.
This introduces the hidden assumption that only the last function in scope will ever use the class methods, which is clearly incorrect. It is somewhat surprising that this is an issue at all, because all functions defined in the same scope should be visible at any time (i.e., back references should be possible) but the fact that this line suspiciously removes the last node and re-appends it (usually the validator, especially in the small test cases in the test suite) is suspiciously suspicious.
opshin/opshin/type_inference.py
Line 681 in d02736a