Skip to content

Ensure singleton class ancestors are linearized when created out of resolution loop#735

Merged
vinistock merged 1 commit intomainfrom
04-13-ensure_singleton_class_ancestors_are_linearized_when_created_out_of_resolution_loop
Apr 20, 2026
Merged

Ensure singleton class ancestors are linearized when created out of resolution loop#735
vinistock merged 1 commit intomainfrom
04-13-ensure_singleton_class_ancestors_are_linearized_when_created_out_of_resolution_loop

Conversation

@vinistock
Copy link
Copy Markdown
Member

@vinistock vinistock commented Apr 13, 2026

In get_or_create_singleton_class, we were lazily creating singleton classes and enqueueing their ancestors for linearization. The problem is that we invoke this method for handling definitions too and that happens after the resolution loop finished, which means that the enqueue work was always ignored.

There are a few ways to solve this:

  1. Drain the queue again after handling definitions
  2. Move handling all definitions inside of the same unified loop
  3. Create an eager/lazy mode for linearizing the ancestors of lazily created singleton classes, so that any calls to get_or_create_singleton_class inside of the resolution loop enqueue work and all others eagerly linearize

I believe 1 is not a good option as we'll need to loop through everything again, including unresolved references. Option 2 seems like the most elegant of all, but it might be a considerably large refactor, so I went with option 3 for now.

@vinistock vinistock self-assigned this Apr 13, 2026
Copy link
Copy Markdown
Member Author

vinistock commented Apr 13, 2026

@vinistock vinistock added the bugfix A change that fixes an existing bug label Apr 13, 2026
@vinistock vinistock marked this pull request as ready for review April 13, 2026 21:50
@vinistock vinistock requested a review from a team as a code owner April 13, 2026 21:50
@vinistock vinistock force-pushed the 04-13-ensure_singleton_class_ancestors_are_linearized_when_created_out_of_resolution_loop branch from f43d80c to 9cf0e8e Compare April 15, 2026 15:42
@vinistock vinistock force-pushed the 04-13-ensure_singleton_class_ancestors_are_linearized_when_created_out_of_resolution_loop branch from 9cf0e8e to 3c94917 Compare April 20, 2026 17:50
@vinistock vinistock enabled auto-merge April 20, 2026 17:51
@vinistock vinistock merged commit 125b98c into main Apr 20, 2026
36 checks passed
@vinistock vinistock deleted the 04-13-ensure_singleton_class_ancestors_are_linearized_when_created_out_of_resolution_loop branch April 20, 2026 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix A change that fixes an existing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants