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

Remove unpack field from SemanticIndexBuilder #14101

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dhruvmanila
Copy link
Member

@dhruvmanila dhruvmanila commented Nov 5, 2024

Summary

Related to #13979 (comment), this PR removes the current_unpack state field from SemanticIndexBuilder and passes the Unpack ingredient via the CurrentAssignment -> DefinitionNodeRef conversion to finally store it on DefintionNodeKind.

This involves updating the lifetime of AnyParameterRef (parameter to declare_parameter) to use the 'db lifetime. Currently, all AST nodes stored on various enums are marked with 'a lifetime but they're always utilized using the 'db lifetime.

This also removes the dedicated 'a lifetime parameter on add_definition which is currently being used in DefinitionNodeRef. As mentioned, all AST nodes live through the 'db lifetime so we can remove the 'a lifetime parameter from that method and use the 'db lifetime instead.

@dhruvmanila dhruvmanila added the red-knot Multi-file analysis & type inference label Nov 5, 2024
Copy link
Contributor

github-actions bot commented Nov 5, 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 November 5, 2024 09:35
@@ -210,13 +211,9 @@ pub(crate) struct MatchPatternDefinitionNodeRef<'a> {
pub(crate) index: u32,
}

impl DefinitionNodeRef<'_> {
impl<'db> DefinitionNodeRef<'db> {
Copy link
Member

Choose a reason for hiding this comment

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

Nit: I would use 'a here to be consistent with the DefinitionNodeRef definition and we don't use db here

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