Instagram / Instagram/LibCST

`AsName.name` has incorrect type annotations

Open
#503 3 comments 0 reactions 0 assignees View on GitHub
documentation good first issue parsing
Dominant language
Python
Stars
1.9k
Forks
229
PR merge metrics
No merged PRs in 30d

Description

For example it can be a `Subscript`, not just `Name | List | Tuple`.

In fact I think there are two kinds of `AsName`s - the ones in imports and except handlers can only take a `Name`, while the ones in with statements can accept any target expression (`BaseAssignTargetExpression`).

```
echo 'with x as a[1]: ...' | python -m libcst.tool print -
Module(
body=[
With(
items=[
WithItem(
item=Name(
value='x',
),
asname=AsName(
name=Subscript(
value=Name(
value='a',
),
slice=[
SubscriptElement(
slice=Index(
value=Integer(
value='1',
),
),
),
],
),
),
),
],
body=SimpleStatementSuite(
body=[
Expr(
value=Ellipsis(),
),
],
),
),
],
)
```

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.