Repository navigation
Resolve a subclass's module statics to its own class - #1369
Conversation
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.
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. |
There was a problem hiding this comment.
💡 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.
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
for b in Bsometimes iteratedA_LinkedListModule_iterator()when B extends A and both useLinkedListModule. 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: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 iteratordoSmthcalls, 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.