Can symbol table node replace an existing one? These are the only valid cases: 1. Placeholder gets replaced with a non-placeholder 2. Placeholder that isn't known to become type replaced with a placeholder that can become a type
(old: SymbolTableNode, new: SymbolTableNode)
| 8339 | |
| 8340 | |
| 8341 | def is_valid_replacement(old: SymbolTableNode, new: SymbolTableNode) -> bool: |
| 8342 | """Can symbol table node replace an existing one? |
| 8343 | |
| 8344 | These are the only valid cases: |
| 8345 | |
| 8346 | 1. Placeholder gets replaced with a non-placeholder |
| 8347 | 2. Placeholder that isn't known to become type replaced with a |
| 8348 | placeholder that can become a type |
| 8349 | """ |
| 8350 | if isinstance(old.node, PlaceholderNode): |
| 8351 | if isinstance(new.node, PlaceholderNode): |
| 8352 | return not old.node.becomes_typeinfo and new.node.becomes_typeinfo |
| 8353 | else: |
| 8354 | return True |
| 8355 | return False |
| 8356 | |
| 8357 | |
| 8358 | def is_same_symbol(a: SymbolNode | None, b: SymbolNode | None) -> bool: |
no test coverage detected
searching dependent graphs…