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

Add tests for "keyword as identifier" syntax errors #14754

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

dhruvmanila
Copy link
Member

@dhruvmanila dhruvmanila commented Dec 3, 2024

Summary

This is related to #13778, more specifically #13778 (comment).

This PR adds various test cases where a keyword is being where an identifier is expected. The tests are to make sure that red knot doesn't panic, raises the syntax error and the identifier is added to the symbol table. The final part allows editor related features like renaming the symbol.

@dhruvmanila dhruvmanila added the red-knot Multi-file analysis & type inference label Dec 3, 2024
@dhruvmanila dhruvmanila force-pushed the dhruv/keyword-as-identifier branch from 7fee9f8 to 8b158c0 Compare December 3, 2024 11:47
@dhruvmanila dhruvmanila changed the base branch from dhruv/identifier-parse-result to main December 3, 2024 11:47
@dhruvmanila dhruvmanila closed this Dec 3, 2024
@dhruvmanila dhruvmanila reopened this Dec 3, 2024
Copy link
Contributor

github-actions bot commented Dec 3, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@dhruvmanila dhruvmanila marked this pull request as ready for review December 5, 2024 09:23
# error: [invalid-syntax]
pass

# TODO: Why is there two diagnostics for the same error?
Copy link
Member

Choose a reason for hiding this comment

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

That's interesting

Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

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

Thank you

@dhruvmanila dhruvmanila merged commit 43bf1a8 into main Dec 5, 2024
37 of 41 checks passed
@dhruvmanila dhruvmanila deleted the dhruv/keyword-as-identifier branch December 5, 2024 12:02
dhruvmanila added a commit that referenced this pull request Dec 5, 2024
…14788)

## Summary

Ref: #14754 (comment)

## Test Plan

Remove the TODO comment and update the mdtest.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
red-knot Multi-file analysis & type inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants