fix: method-level generic return type overwritten by receiver class generic resolution#3439
Open
tomlau10 wants to merge 1 commit into
Open
fix: method-level generic return type overwritten by receiver class generic resolution#3439tomlau10 wants to merge 1 commit into
tomlau10 wants to merge 1 commit into
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
tomlau10
force-pushed
the
fix/generic-return-overwrite
branch
from
July 26, 2026 09:15
7843eec to
8284020
Compare
When a generic class method returns a method-level generic, the receiver block clone would overwrite Round 1's correct resolution with an unresolved node. Skip the clone if the return doc references generics not in the class genericMap. Discussion: LuaLS#3438
tomlau10
force-pushed
the
fix/generic-return-overwrite
branch
from
July 26, 2026 09:17
8284020 to
bafa71b
Compare
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.
Closes a regression where
@return Ron a generic class method resolves tounknownwhenRis method-level (not in the class genericMap).The receiver block was overwriting Round 1's correct resolution with a clone using only the class generic map, leaving method-level generics unresolved.
Fix: scout-before-clone — skip the receiver block if the return doc references generics not present in the class genericMap.
See discussion for full report and TL;DR: #3438 (comment)
中文版
generic class method 的
@return如果用了 method-level 的 generic(例如@return R,而R不在 class 的 generic 參數裡),回傳值會錯誤地變成unknown。原因是 receiver block 只拿了 class genericMap(如
{T=string})去 clone return doc,沒在 map 裡的 generic(如R)會留 unresolved,直接蓋掉 Round 1 已經正確解好的結果。修法:scout-before-clone — clone 前先掃 return doc 有沒有 generic name 不在 genericMap 中,有就 skip receiver block,保留 Round 1 的答案。
詳細的 TL;DR 與 report 請見上面的 discussion link。
PS:
deepseek-v4-flashdebug 的當時我只有 insight 但不知怎樣改,在我說完 insight 後 deepseek 就說
你的分析是對的然後他就搞定了 🤣