Skip to content

Lua dispatch: keep same-named classes of different packages in groups of their own - #1432

Merged
Frotty merged 2 commits into
masterfrom
lua-dispatch-key-packages
Oct 11, 2026
Merged

Frotty merged 2 commits into
masterfrom
lua-dispatch-key-packages

Conversation

@Frotty

@Frotty Frotty commented Oct 11, 2026

Copy link
Copy Markdown
Member

The Lua dispatch preparation groups the methods of an override family into slots by a key made of names: the class, the method and its implementation, then the types of the signature, where a class is its name and a type variable its owner's name, position and name. Two packages may each declare a class of the same name, so two unrelated families could get the same key. Then they share one dispatch group, and their parameter signatures compare equal when aliases are chosen.

Two packages which each declare Box<T>, First<T> and Second<T> show it: both families of pick were bound to the one slot Box_pick. That program still ran correctly, because each class has its own table. I found no program where a shared key dispatches wrongly: Wurst cannot name two classes of the same name in one scope, and a class cannot hold two methods with the same name and signature. The keys break the rule that identity is not taken from names, though (AGENTS.md §7), and the alias selection relies on them.

What changes

  • A dispatch signature key now ends with the packages of the classes and type-variable owners it names, behind a \u0001 separator. The group key also ends with the package of the class it is named after.
  • The separator sorts below every character a key contains. So keys which differed before keep their order (the order in which groups are named), and only keys which were equal because of same-named classes are split.

Effect

The two families get slots of their own (Box_pick, Box_pick1), in any order of the compilation units. Castle fight and zombie defense compile byte-identical (-inline -localOptimizations, Lua); neither has such a pair. Not run in game.

Tests

  • sameNamedGenericHierarchiesInTwoPackagesKeepTheirOwnDispatchGroups and its new-generics twin (DeterministicChecks): run the program on Jass, in the interpreter and on Lua; check that each package's First binds pick to its own slot; and check that the Lua is the same with the compilation units shuffled. Both fail on master.
  • Passed: DeterministicChecks, LuaTranslationTests, LuaBackendAuditTests, GenericsTests, ClassesTests, InterfaceTests, FieldIterationTests, ClosureTests. The full suite is left to CI.

… of their own

A dispatch group's key named the class, the method and the types of its signature by name only, so two packages which each declare Box, First and Second shared one group for pick. The keys now end with the packages of the classes and type-variable owners they name, behind a separator which keeps the order of keys which differed before.
@Frotty

Frotty commented Oct 11, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T08:54:07.303746Z 69eacbe Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 965b8a5be3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Frotty

Frotty commented Oct 11, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 69eacbee0f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Frotty
Frotty merged commit 5df187e into master Oct 11, 2026
3 checks passed
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.

1 participant