Instagram / Instagram/LibCST

CSTNode.deep_replace type annotations incomplete

Open
#906 0 comments 1 reaction 0 assignees View on GitHub
bug machinery
Dominant language
Python
Stars
1.9k
Forks
229
PR merge metrics
No merged PRs in 30d

Description

Using `module.deep_replace()` with `RemovalSentinel.REMOVE` or `FlattenSentinel` results in a typecheck error because the second parameter to `deep_replace` is only annotated as accepting `CSTNodeT`, even though it wraps a transformer that accepts the remove/flatten sentinels.

```
src/fixit/engine.py:121: error: Argument 2 to "deep_replace" of "CSTNode" has incompatible type "Union[CSTNode, FlattenSentinel[Any], RemovalSentinel]"; expected Module [arg-type]
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.