Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for not parsing subscripts such as cast()["from"] #428

Merged
merged 1 commit into from
Dec 8, 2020

Conversation

Kronuz
Copy link
Contributor

@Kronuz Kronuz commented Dec 8, 2020

Summary

When handling subscripts, cast(), and potentially others such as TypeVar() and NewType(), were being treated as potential string type hints, resulting in snippets like the following failing with a ParserSyntaxError:

cast(Dict[str, str], {})["from"]

Test Plan

Run tests

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 8, 2020
@Kronuz Kronuz force-pushed the Kronuz-scope_provider-subscripts branch from 1f0bb04 to fd444fe Compare December 8, 2020 00:58
@codecov-io
Copy link

Codecov Report

Merging #428 (fd444fe) into master (8eee3cc) will decrease coverage by 0.02%.
The diff coverage is 76.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #428      +/-   ##
==========================================
- Coverage   94.33%   94.31%   -0.03%     
==========================================
  Files         232      232              
  Lines       22586    22606      +20     
==========================================
+ Hits        21307    21321      +14     
- Misses       1279     1285       +6     
Impacted Files Coverage Δ
libcst/metadata/tests/test_scope_provider.py 99.20% <68.42%> (-0.80%) ⬇️
libcst/metadata/scope_provider.py 96.57% <100.00%> (+<0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8eee3cc...fd444fe. Read the comment docs.

Copy link
Contributor

@jimmylai jimmylai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
@Kronuz thanks for fixing this quickly.

@jimmylai jimmylai merged commit 2f117f0 into master Dec 8, 2020
@lpetre lpetre deleted the Kronuz-scope_provider-subscripts branch November 19, 2021 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants