Skip to content

Upgrade Python #358

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

Merged
merged 4 commits into from
Jan 29, 2024
Merged

Upgrade Python #358

merged 4 commits into from
Jan 29, 2024

Conversation

hendrikvanantwerpen
Copy link
Collaborator

@hendrikvanantwerpen hendrikvanantwerpen commented Nov 30, 2023

« #282

Changes the rules as follows:

  • Support the latest Python grammar release.
  • Be more precise about which identifiers are definitions.
  • Fix some import cases.

The rules were introducing definitions for all identifiers, regardless of whether they appeared in a definition context. This made the rules easy, but results in unexpected behavior in the UI, because every reference is now also a definition and included in the results for that reference.

Interestingly, this worked in the old DSL because the graph was pruned, so unconnected definitions would just disappear!

To fix this, the rules must be more specific about which identifiers should actually give rise to definitions. The grammar is not optimized for this. For example, (pattern/identifier) does not actually catch all identifiers that appear in patterns. This is why many constructs are explicitly listed in the identifier rule.

All tests do pass again, but the explicit listing of identifiers makes it more likely that I overlooked cases. We may want to revisit this in the future and consider restructuring the grammar to make this easier.

@BekaValentine BekaValentine merged commit cd9f3eb into add-python Jan 29, 2024
@BekaValentine BekaValentine deleted the upgrade-python branch January 29, 2024 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants