Repository navigation
Conversation
Jass's typeIdToTypeName, instanceCount and maxInstanceCount searched the type ids without bounds: the
search narrows to one id even for a number below the first or above the last, so 0 answered for the first
class and maxTypeId() + 1 for the last. Each leaf now checks the id, so any other number gets the default
("unknown", 0), as on Lua.
The interpreter counted the objects of the class alone, gave as maxInstanceCount the objects ever made,
and raised for an unknown number. It now keeps the live objects and their peak per allocator group, the
classes joined by inheritance, which is what both targets count, and answers the defaults for an unknown
number. reflectionNativesAnswerAsOnJass and reflectionAnswersDefaultsForNumbersWhichAreNoTypeId run in the
interpreter and on Jass too; each fails without its part of the change.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Oct 21, 2026
Closed
Member
Author
|
Superseded by #1519, which was merged with the same changes before this split was finished. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split out of #1519, which this replaces together with #1520 and #1522. The change is unchanged; #1519's Codex rounds reviewed it.
Problem
typeIdToTypeName,instanceCountandmaxInstanceCountsearch the type ids with a binary search whose leaf returns its class without checking the id. SotypeIdToTypeName(0)answered the first class's name andmaxTypeId() + 1the last class's, where Lua answers the defaults ("unknown", 0).maxInstanceCount, and raised for an unknown number. Compile-time code sees the interpreter.Change
ProgramState.classKeyLookup), which is what both targets count, and answers the defaults for an unknown number.BACKLOG.mddrops the entry anddocs/WC3_RUNTIME.mdthe two differences.Tests
LuaTranslationTests.reflectionNativesAnswerAsOnJassandreflectionAnswersDefaultsForNumbersWhichAreNoTypeIdnow run in the interpreter and on Jass too. Without the change they fail there (the interpreter raises, and Jass answers the first class).Validation: see the results at the end.
Merging: this and #1520 edit neighbouring lines in
ProgramState,BACKLOG.mdanddocs/WC3_RUNTIME.md, so the second to merge needs master merged in. The union of the three PRs is #1519's tree.Validation (Windows, bundled Lua 5.3,
-PallBackends): LuaTranslationTests 149, InterpreterTests 29, CompiletimeTests 50, NewFeatureTests 42, ClassesTests 128, all passing. Not done: Linux and macOS.