Skip to content

Resolve a subclass's module statics to its own class - #1369

Merged
Frotty merged 2 commits into
masterfrom
claude/priceless-chatterjee-b4dfe3
Oct 6, 2026
Merged

Frotty merged 2 commits into
masterfrom
claude/priceless-chatterjee-b4dfe3

Conversation

@Frotty

@Frotty Frotty commented Oct 6, 2026

Copy link
Copy Markdown
Member

for b in B sometimes iterated A_LinkedListModule_iterator() when B extends A and both use LinkedListModule. Which one it picked depended on the identity hash codes of the AST nodes, so it varied from compile to compile.

B's name links hold two zero-parameter static iterators: its own and the one it inherits from A. Two places chose between them badly:

  • The for-in lookup took whichever one the hash set listed first.
  • Explicit calls (B.iterator(), D.iterator()) were rejected as ambiguous, because the two module instantiations are unrelated receiver types and the "most specific receiver" tie-break could not order them.

The class that owns the module instantiation now breaks that tie, and the for-in lookup uses the same tie-break as explicit calls.

Tests in BugTests: the stdlib test now asserts which class's iterator doSmth calls, and a new self-contained test compiles a mini module 40 times in one JVM and checks the calls and that all five Jass variants are identical each time. It fails without the fix.

Focused suites run locally: BugTests, ModuleTests, ClosureTests, GenericsModuleTests, ClassesTests, ClassesExtTests, ExtensionMethodsTests, OpOverloading, SimpleStatementTests, ScopingTests, InterfaceTests, VarargTests.

B extends A and both use a module: B's per-class static iterator() and the
one it inherits from A are both candidates. For-in took whichever the hash
set listed first, and explicit calls were reported as ambiguous because the
two module instantiations are unrelated receiver types.

Let the class owning the module instantiation break that tie, and use the
same tie-break for the for-in iterator lookup.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 6, 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-06T10:40:12.390062Z a75d2d5 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: 0fd8bcc038

ℹ️ 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".

The for-in iterator lookup compared receivers across members and
extensions, so an extension iterator() on a subclass hid the member the
class inherits. Compare within members first, and only rank module
instantiations against each other by owning class.
@Frotty

Frotty commented Oct 6, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: a75d2d5916

ℹ️ 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 8a861c8 into master Oct 6, 2026
3 checks passed
@Frotty
Frotty deleted the claude/priceless-chatterjee-b4dfe3 branch November 25, 2026 08:53
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