Skip to content

refactor: Fix a bug in reorganize_definitions for uses of foreign types#1732

Merged
ahomescu merged 3 commits intomasterfrom
ahomescu/fix_reorganize_foreign_types
Apr 13, 2026
Merged

refactor: Fix a bug in reorganize_definitions for uses of foreign types#1732
ahomescu merged 3 commits intomasterfrom
ahomescu/fix_reorganize_foreign_types

Conversation

@ahomescu
Copy link
Copy Markdown
Contributor

@ahomescu ahomescu commented Apr 7, 2026

@ahomescu ahomescu force-pushed the ahomescu/fix_reorganize_foreign_types branch from 018672b to 26ed001 Compare April 7, 2026 01:27
Copy link
Copy Markdown
Contributor

@randomPoison randomPoison left a comment

Choose a reason for hiding this comment

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

Can you give a bit of context for what this change is accomplishing and why it's needed, e.g. what bug you're trying to fix? I'm not intimately familiar with reorganize definitions, nor with the CRISP changes that I assume are the motivation for this, and I'm having trouble understanding from the test change what the expected change in behavior is.

In general, it'd be helpful to provide this context in the PR description. Reviewing a change without context is hard and time consuming because I have to do a bunch of digging to figure out the context for myself.

@ahomescu
Copy link
Copy Markdown
Contributor Author

ahomescu commented Apr 7, 2026

Can you give a bit of context for what this change is accomplishing and why it's needed, e.g. what bug you're trying to fix?

We don't seem to have a bug yet, I can go open one. Stuart reported a crash in reorganize_definitions when transpiling libexpat.

@ahomescu
Copy link
Copy Markdown
Contributor Author

ahomescu commented Apr 7, 2026

I'm not intimately familiar with reorganize definitions

I'm not sure who else is, other than me.

@kkysen kkysen changed the title Fix a bug in reorganize_definitions for uses of foreign types refactor: Fix a bug in reorganize_definitions for uses of foreign types Apr 7, 2026
@randomPoison
Copy link
Copy Markdown
Contributor

We don't seem to have a bug yet, I can go open one.

That's fine, I don't necessarily need a ticket for it, but it'd be helpful if you can explain here what behavior you're trying to change.

I'm not intimately familiar with reorganize definitions

I'm not sure who else is, other than me.

That's also fine, I'm still able to review this, and reviewing changes like this is part of building an understanding of the refactorer and this transform. But since I (and others) don't have the context already, it's helpful if you can provide that context.

Copy link
Copy Markdown
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.

Could you put the new test code in a new snapshot test? The current one doesn't compile after reorganize_definitions, so it's missing an important part of testing (which would catch this bug). So could you put it in its own snapshot file, initially set .new_expect_compile_error(true), and then remove that in the 3rd commit that fixes the bug?

Otherwise, the changes to the refactorer and to the snapshot LGTM.

@ahomescu ahomescu force-pushed the ahomescu/fix_reorganize_foreign_types branch from 26ed001 to cce4c5b Compare April 8, 2026 02:14
@ahomescu ahomescu force-pushed the ahomescu/thin_binaries branch from a1b7d9f to 03aff27 Compare April 8, 2026 02:14
@ahomescu
Copy link
Copy Markdown
Contributor Author

ahomescu commented Apr 8, 2026

So could you put it in its own snapshot file

That was my original approach, but it seemed like we already put all the tests for a transform in one file? Or should I use named?

@ahomescu ahomescu force-pushed the ahomescu/fix_reorganize_foreign_types branch 2 times, most recently from e1b743a to 354ce9e Compare April 8, 2026 02:26
Copy link
Copy Markdown
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 besides sorting the tests.

Base automatically changed from ahomescu/thin_binaries to master April 9, 2026 23:03
@ahomescu ahomescu force-pushed the ahomescu/fix_reorganize_foreign_types branch from 354ce9e to 0a0fd75 Compare April 9, 2026 23:08
@ahomescu ahomescu merged commit 7c5f899 into master Apr 13, 2026
11 checks passed
@ahomescu ahomescu deleted the ahomescu/fix_reorganize_foreign_types branch April 13, 2026 22:32
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.

reorganize_definitions produces broken code on libexpat

3 participants