Repository navigation
Build override error messages only where they are reported - #1538
Conversation
A check whether one function can override another built the message saying why not, and most pairs it compares are overloads which cannot, so a large real map spent about 1% of its build formatting messages nobody read (three regular expressions each for the element's type name). canOverride now asks for the answer alone, the class name links record a failed override and make its message only for a function marked override which overrides nothing, and printElement makes the readable type name only for the elements which print it. The messages are unchanged.
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. |
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
When canOverride compares same-arity methods whose own type-parameter counts or constraints differ, this unconditional call still constructs the full error string in checkOwnTypeParameters—including Utils.printElement/source formatting—even though explain is false. This leaves the hot predicate allocating diagnostics for generic overload sets and contradicts overrideError's documented constant-only predicate mode; pass explain into this check or separate the compatibility predicate from message construction.
ℹ️ 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".
… answer is asked canOverride still built checkOwnTypeParameters' message, with the overridden function's printed element and source, for a pair whose own type parameters differ in number or bounds. It now takes explain too and answers with the constant.
|
Addressed in 1284438: |
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! 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". |
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. 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". |
Checking whether one function can override another built the message explaining why not.
canOverridecompared that message with null. Most pairs it compares are overloads with different parameter counts, so a build formatted thousands of messages nobody read. Each went throughUtils.printElement, which runs three regular expressions for the element's type name, even for element kinds that never print it.NameLinksalso built a message for every failed pair, but reads them only for a function markedoverridethat overrides nothing.Change:
canOverrideandcheckOverrideshareoverrideError(..., explain), socanOverridegets a constant instead of a built message.NameLinksrecords the failed pair, and makes its message only when reporting "does not override anything", in the same order.printElementmakes the readable type name only for the elements that print it.Measured on a large real map's Lua build, by JFR main-thread samples:
checkOverridefell from 22–33 samples to 0,printElementandmakeReadableTypeNamefrom 7–20 to 0, andcanOverridefrom 14–19 to 3–6.cmp, over interleaved runs).Tests, which assert the override messages:
ClassesTests,ClassesExtTests,GenericsTests,GenericsWithTypeclassesTests,TypeClassTests,InterfaceTests,GenericSpecialisationMatrixTests,ModuleTestsandDispatchImplementationTestsall pass, 1,001 tests in total.