Skip to content

Conversation

@fw-immunant
Copy link
Contributor

I think this is the right way to fix this. I tried adding a WithStmtsAndImports type instead, to avoid larger shared state, but it ended up infecting almost the entire transpiler.

@fw-immunant
Copy link
Contributor Author

This is atop the "enable" branch, despite being a prerequisite fix, so that it gets test coverage in CI.

@fw-immunant
Copy link
Contributor Author

The testsuite is failing in a way that indicates this isn't sufficient to capture all required imports. We might need to handle import deferral nestably.

@fw-immunant fw-immunant force-pushed the fw/defer-imports-v2 branch 3 times, most recently from f5d04aa to 8dae9ac Compare November 17, 2025 20:26
@fw-immunant fw-immunant requested a review from kkysen November 17, 2025 20:43
@fw-immunant
Copy link
Contributor Author

Ready for review now.

Copy link
Contributor

@kkysen kkysen left a comment

Choose a reason for hiding this comment

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

Forgot to submit this last night. Still reviewing the rest.

Copy link
Contributor

@kkysen kkysen left a comment

Choose a reason for hiding this comment

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

The overall logic makes sense to me. I had a question about the fn import_for_type implementation, though, and then a few nitpicks of other things.

@kkysen kkysen force-pushed the kkysen/reorganize-definitions-enable branch from b1993e9 to c191695 Compare November 20, 2025 21:30
@kkysen kkysen force-pushed the fw/defer-imports-v2 branch from 9fc0fff to ecdc322 Compare November 20, 2025 21:30
@kkysen
Copy link
Contributor

kkysen commented Nov 20, 2025

Also, I force pushed to rebase since there was some issue with outdated CI that was changed on master already.

Copy link
Contributor

@kkysen kkysen left a comment

Choose a reason for hiding this comment

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

LGTM now! Don't merge it yet, though, as I want to remove the PR in front of this since we don't want to enable it default.

computing these is impure because it can call `import_type`. ideally we would
not disable this caching but instead cache both the initializer and its set of
required imports.
this lets us cache required imports alongside the zero-initializer expressions themselves

we remove the `decl_file_id` passed in many places because we want to track the real dependencies of decls, without yet taking into account which file we are in; when we later turn this information into `use` items, we skip imports that are not necessary from a given importing location
@kkysen kkysen force-pushed the fw/defer-imports-v2 branch from be7c164 to 5f61068 Compare November 21, 2025 21:32
@kkysen kkysen changed the title [stacked] transpile: defer+cache imports alongside zero initializers transpile: defer+cache imports alongside zero initializers Nov 21, 2025
@kkysen kkysen changed the base branch from kkysen/reorganize-definitions-enable to master November 21, 2025 21:33
@kkysen kkysen merged commit f4be910 into master Nov 21, 2025
@kkysen kkysen deleted the fw/defer-imports-v2 branch November 21, 2025 21:34
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.

3 participants