Skip to content

Remove unpack field from SemanticIndexBuilder#14101

Merged
dhruvmanila merged 1 commit intomainfrom
dhruv/unpack-cleanup
Nov 6, 2024
Merged

Remove unpack field from SemanticIndexBuilder#14101
dhruvmanila merged 1 commit intomainfrom
dhruv/unpack-cleanup

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 ty Multi-file analysis & type inference label Nov 5, 2024
@github-actions
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
}

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

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the main reason to use 'db here is because I've used that in DefinitionKind as well which is the return type of DefinitionNodeRef::into_owned function.

Copy link
Contributor

@carljm carljm left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@dhruvmanila dhruvmanila merged commit 34b6a9b into main Nov 6, 2024
@dhruvmanila dhruvmanila deleted the dhruv/unpack-cleanup branch November 6, 2024 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants